Conta e uso
GET/v1/me
Quem sou eu: organização, permissões e limites desta credencial
Resposta 200
| Nome | Tipo | Descrição |
|---|---|---|
credential obrigatório | object | |
credential.kind obrigatório | "key" | "oauth" | "client" | key = API key, oauth = app connected by a person, client = organization app |
credential.id obrigatório | string | |
credential.name obrigatório | string | |
credential.mode obrigatório | "live" | "test" | |
credential.needs_review obrigatório | boolean | |
organization obrigatório | object | null | |
organization.id obrigatório | string | |
organization.name obrigatório | string | |
user obrigatório | object | null | |
user.id obrigatório | string | |
user.name obrigatório | string | null | |
permissions obrigatório | string[] | |
limits obrigatório | object | |
limits.spend_day_minutes obrigatório | number | null | |
limits.spend_month_minutes obrigatório | number | null | |
limits.per_call_minutes obrigatório | number | null | |
limits.requests_per_minute obrigatório | number | |
limits.spent_today_minutes obrigatório | number | |
limits.spent_month_minutes obrigatório | number | |
pricing obrigatório | object | |
pricing.api_minute_factor obrigatório | number | |
pricing.listen_text_factor obrigatório | number |
Exemplo
curl
curl "https://api.kanutus.com/v1/me" \
-H "Authorization: Bearer $KANUTUS_API_KEY"Node.js
const res = await fetch("https://api.kanutus.com/v1/me", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.KANUTUS_API_KEY}`,
},
});
console.log(res.status, await res.json());Python
import os, uuid, requests
r = requests.request(
"GET",
"https://api.kanutus.com/v1/me",
headers={"Authorization": f"Bearer {os.environ['KANUTUS_API_KEY']}"},
)
print(r.status_code, r.json())Testar agora
Roda no seu navegador contra a API de verdade. Use uma chave kt_test_: nada é cobrado. A chave fica só nesta aba.
GET /v1/meRespostas por status
200 This credential
200
{
"credential": {
"kind": "key",
"id": "string",
"name": "string",
"mode": "live",
"needs_review": true
},
"organization": {
"id": "string",
"name": "string"
},
"user": {
"id": "string",
"name": "string"
},
"permissions": [
"string"
],
"limits": {
"spend_day_minutes": 0,
"spend_month_minutes": 0,
"per_call_minutes": 0,
"requests_per_minute": 0,
"spent_today_minutes": 0,
"spent_month_minutes": 0
},
"pricing": {
"api_minute_factor": 0,
"listen_text_factor": 0
}
}400 Invalid request
400 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 400,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}401 Missing, invalid, expired or revoked credential
401 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 401,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}403 Missing permission, blocked or not allowed
403 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 403,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}429 Rate limit exceeded (see RateLimit-* and Retry-After headers)
429 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 429,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}GET/v1/balance
Minutos restantes (pool/cota da organização ou plano pessoal)
Resposta 200
| Nome | Tipo | Descrição |
|---|---|---|
minutes_left obrigatório | number | |
seconds_left obrigatório | integer | |
low obrigatório | boolean | |
source obrigatório | "organization" | "personal" | "test" | |
livemode obrigatório | boolean |
Exemplo
curl
curl "https://api.kanutus.com/v1/balance" \
-H "Authorization: Bearer $KANUTUS_API_KEY"Node.js
const res = await fetch("https://api.kanutus.com/v1/balance", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.KANUTUS_API_KEY}`,
},
});
console.log(res.status, await res.json());Python
import os, uuid, requests
r = requests.request(
"GET",
"https://api.kanutus.com/v1/balance",
headers={"Authorization": f"Bearer {os.environ['KANUTUS_API_KEY']}"},
)
print(r.status_code, r.json())Testar agora
Roda no seu navegador contra a API de verdade. Use uma chave kt_test_: nada é cobrado. A chave fica só nesta aba.
GET /v1/balanceRespostas por status
200 Balance
200
{
"minutes_left": 0,
"seconds_left": 0,
"low": true,
"source": "organization",
"livemode": true
}400 Invalid request
400 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 400,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}401 Missing, invalid, expired or revoked credential
401 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 401,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}403 Missing permission, blocked or not allowed
403 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 403,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}429 Rate limit exceeded (see RateLimit-* and Retry-After headers)
429 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 429,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}GET/v1/usage
Uso da API por dia ou por credencial
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
from | query · string | |
to | query · string | |
group_by | query · "day" | "credential" |
Resposta 200
| Nome | Tipo | Descrição |
|---|---|---|
from obrigatório | string | |
to obrigatório | string | |
total_minutes obrigatório | number | |
requests obrigatório | integer | |
errors obrigatório | integer | |
data obrigatório | object[] | |
data[].day | string | |
data[].credential_id | string | |
data[].name | string | |
data[].minutes obrigatório | number | |
data[].requests | integer |
Exemplo
curl
curl "https://api.kanutus.com/v1/usage" \
-H "Authorization: Bearer $KANUTUS_API_KEY"Node.js
const res = await fetch("https://api.kanutus.com/v1/usage", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.KANUTUS_API_KEY}`,
},
});
console.log(res.status, await res.json());Python
import os, uuid, requests
r = requests.request(
"GET",
"https://api.kanutus.com/v1/usage",
headers={"Authorization": f"Bearer {os.environ['KANUTUS_API_KEY']}"},
)
print(r.status_code, r.json())Testar agora
Roda no seu navegador contra a API de verdade. Use uma chave kt_test_: nada é cobrado. A chave fica só nesta aba.
GET /v1/usageRespostas por status
200 Usage (minutes spent through the API)
200
{
"from": "string",
"to": "string",
"total_minutes": 0,
"requests": 0,
"errors": 0,
"data": [
{
"day": "string",
"credential_id": "string",
"name": "string",
"minutes": 0,
"requests": 0
}
]
}400 Invalid request
400 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 400,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}401 Missing, invalid, expired or revoked credential
401 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 401,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}403 Missing permission, blocked or not allowed
403 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 403,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}429 Rate limit exceeded (see RateLimit-* and Retry-After headers)
429 application/problem+json
{
"type": "https://docs.kanutus.com/errors",
"title": "<code>",
"status": 429,
"code": "<code>",
"message": "…",
"request_id": "req_…"
}