Getting started
From key to first GET in five minutes.
- Whoever administers the account creates the key under Settings › API (keys): pick the scope — read-only or read and write — and the responsible user (every write has an author).
- Keep the key: it is shown once. A lost key is revoked and another is created.
- Send the key in the Authorization header (Bearer) on every call. No key: 401.
- Start with GET /api/v1/me (returns the key's account), then list a resource with limit and offset, or incrementally with desde and depoisDe.
Base URL
Every call goes to the URL below, always over HTTPS. Response bodies are UTF-8 JSON; field names are stable within v1.
Base URL
https://tenka.app.br/api/v1First call: the key's account
cURL
curl "https://tenka.app.br/api/v1/me" \
-H "Authorization: Bearer $TENKA_API_KEY"JavaScript
const response = await fetch("https://tenka.app.br/api/v1/me", {
method: "GET",
headers: {
"Authorization": "Bearer " + TENKA_API_KEY
}
});
const data = await response.json();
if (!response.ok || data.erro) throw new Error(response.status + " " + data.erro);
console.log(data);Python
import os
import requests
response = requests.get(
"https://tenka.app.br/api/v1/me",
headers={
"Authorization": f"Bearer {os.environ['TENKA_API_KEY']}",
},
timeout=30,
)
data = response.json()
if not response.ok or "erro" in data:
raise RuntimeError(f"{response.status_code} {data.get('erro')}")
print(data)Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create("https://tenka.app.br/api/v1/me"))
.header("Authorization", "Bearer " + System.getenv("TENKA_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());C#
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("TENKA_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Get, "https://tenka.app.br/api/v1/me");
var response = await http.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");PHP
<?php
$ch = curl_init("https://tenka.app.br/api/v1/me");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("TENKA_API_KEY"),
],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$data = json_decode($body, true);
echo $status . " " . $body;Node (SDK)
// SDK generated from the contract — download at https://tenka.app.br/api/v1/sdk/tenka.js
import { Tenka } from "./tenka.js";
const tenka = new Tenka(process.env.TENKA_API_KEY, "https://tenka.app.br/api/v1");
const data = await tenka.getMe({});
console.log(data);200 · application/json
{
"tenant": 42,
"nome": "Comercial Aurora Ltda",
"cnpj": "12.345.678/0001-00",
"plano": "Evoluir",
"api": "v1"
}Next steps
Read Authentication to choose the right scope and Pagination to sync without full scans; then open the reference of the resource you will integrate: each page has the fields, the errors and the ready-made call in seven languages.