# API

# Authentication

Tratta API uses Access Tokens to authenticate requests. You can request this token at support@tratta.io. Along the access token, you'll be also given your organization's UUID, which is part of the endpoint.

Authentication to the API is performed via bearer auth included in the Authorization header of HTTP request.

curl https://<org-uuid>.production.tratta.io/api/v1/transactions \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# Headers

In order to receive JSON response from Tratta API, a client must send header containing Accept: application/json.

# Environments

Tratta API is available in production and sandbox environments. Sandbox environment can be used to test your integration against. You can get separate API keys for each of them.

# Sandbox

Sandbox environment is available at

curl https://<org-uuid>.sandbox.tratta.io/api/v1

# Production

Production environment is available at

curl https://<org-uuid>.production.tratta.io/api/v1

# Rate Limiting

All requests to API are limited by default to 100 requests per minute. You can request to increase the quota at support@tratta.io.

If you reach the limit the api will respond with an 429 status response.

# Pagination

All API results are by default paginated to 10 records per page. This number of records can be with limit parameter.

# Parameters


limit optional

A limit on the number of records to be returned, between 1 and 500.

# Returns


Pagination can be found in meta and links properties of response. Paginated links preserve query parameters.

meta

from_submitted_date and to_submitted_date represent submitted_date for the first and last records in returned page.

"meta" : {
  "from_submitted_date": '2020-10-10 10:30:00',
  "to_submitted_date": '2020:10-10 10:00:00',
  "from" : 1,
  "current_page" : 1,
  "total" : 2229980,
  "to" : 20,
  "last_page" : 111499,
  "per_page" : "20",
  "path" : "https://api.tratta.io/api/v1/transactions"
}

links

"links" : {
  "prev" : null,
  "next" : "https://api.tratta.io/api/v1/transactions?page=2&limit=10",
  "first" : "https://api.tratta.io/api/v1/transactions?page=1&limit=10",
  "last" : "https://api.tratta.io/api/v1/transactions?page=111499&limit=10"
}

# Requests

Body parameters in the docs usually have validation rules / abbreviations associated with them. Here's their explanation:

# optional

Property must either be missing from the body payload or in valid format specified by other validation rules.

# Success response

Success response comes in the following format with 2XX HTTP status code

{
  "data": "array or object"
}

# Error response

Error response comes in the following format with 4XX HTTP status code

{
  "error": "error message",
  "errorCode": "optional error code"
}

If there's a relation between API resources, you can include the whole related resource object in response using include in query parameters.

For example

curl https://<org-uuid>.production.tratta.io/api/v1/debt-accounts/1234-5678 \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d include="customer" \
 -G
{
  # debt account parameters
  "customer": "object",
}

If you want to include multiple related resources, you can delimit them with comma: ?include=customer,payments.

# Migration

Tratta is working on introducing Partnerships. Partnerships will allow User to be a part of multiple Organizations and ability to assign granular permissions to each User - Organization Partnership. To allow this behavior, we're changing general https://api.tratta.io API endpoint to Organization specific endpoints.

# Migration guide

Tratta generic endpoint https://api.tratta.io is changing to Organization specific one. Upcoming format is

<organization-uuid>.<environment>.tratta.io

This means Organization with uuid 123456 would use the API endpoint

# Production Environment
https://123456.production.tratta.io 

# Sandbox Environment
https://123456.sandbox.tratta.io