Skip to main content

API

Overview

We provide a programmatic interface to all resources available to the user. The API is available at https://api.tuna.am for all registered users.

All resources are collected on a separate page, where you can also test the operation of a method of interest by specifying your API key in SwaggerUI.

Quick Start

Before you begin, you need to create an API key, which can be done on a separate page. For authentication, the key must be passed in the HTTP header Authorization: Bearer {API-key}

note

The deprecated variant Authentication: Bearer {API-key} is supported but may be removed in the future. Please use the current header.

Example with cURL

To get the user description, execute a request using curl:

curl -H "Authorization: Bearer {API-key}" https://api.tuna.am/v1/user

Example with tuna

tuna config save-api-key "{API-key}"
tuna domain list

Errors

HTTP Status Codes

Errors usually return a 4xx response code. Less frequently, you may receive 5xx errors - this means the error is related to the tuna API, not your code.

Error Format

All errors returned by tuna have the following format:

{
"code": "BadRequest",
"error": "Incorrect identifier: strconv.ParseInt: parsing \"foobar\": invalid syntax",
"request_id": "785f3f7e174cc6dc2c2d359bed4d921d"
}

Errors always contain the code field and optionally text in the error field.