# API

# Authentication

Tratta API uses Access Tokens to authenticate requests. You can request this token at support@tratta.io.

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

curl https://api.tratta.io/api/v1/transactions \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# 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://sandbox-api.tratta.io/api/v1

# Production

Production environment is available at

curl https://api.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.

# 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://api.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.