# API reference
The Klarety API is what the Python SDK and the app use. Call it from any language that speaks HTTPS and JSON.
A generated reference with every field is coming. Until then, this page lists the endpoint areas and the SDK pages show each call in use.
## Base URL [#base-url]
```text
https://api.klarety.ai/v1
```
All requests use HTTPS with JSON bodies.
## Authentication [#authentication]
### Exchange your key for a token [#exchange-your-key-for-a-token]
```bash
curl -s https://api.klarety.ai/v1/token \
-H "Content-Type: application/json" \
-d "{\"api_key\": \"$KLARETY_API_KEY\"}"
```
The answer has `access_token`, `token_type` (`Bearer`) and `expires_in` (3600 seconds).
### Send it on every request [#send-it-on-every-request]
```bash
curl -s https://api.klarety.ai/v1/account -H "Authorization: Bearer $TOKEN"
```
Exchange the key again before the hour is up.
See [Authentication](/docs/developers/authentication) for keys and rotation.
## Conventions [#conventions]
### Errors [#errors]
Every failure is an RFC 9457 `application/problem+json` body with `type`, `title`, `status`, `detail` and `instance`. See [Errors](/docs/developers/errors).
### Pagination [#pagination]
List endpoints return one page and a cursor. Pass it back for the next page; an empty or missing cursor means the last page. Its name depends on the endpoint (`next_cursor` or `next`, sent back as `cursor` or `after`). The SDK pages for you.
### Safe retries [#safe-retries]
- `POST /v1/sql` takes a `statement_id` (a UUID you choose). Resending it never runs the statement twice; it returns the answer, or `"state": "running"` to ask again at `GET /v1/sql/statements/{statement_id}`.
- `POST /v1/tables/{name}/rows/edit` takes a `write_id`. A write that already landed is answered as saved.
### Sizes [#sizes]
Request bodies are limited to 1 MiB. Files go through upload links that last one hour.
## Endpoint areas [#endpoint-areas]
### Account and limits [#account-and-limits]
### SQL and Spark [#sql-and-spark]
### Tables and schemas [#tables-and-schemas]
Also: expectations, column docs, quality, changes, authors, erase, delete and restore under `/v1/tables/{name}/...`, and restores of earlier copies under `/v1/restores`.
### Ingest and uploads [#ingest-and-uploads]
### Jobs [#jobs]
### Files and folders [#files-and-folders]
### Connections [#connections]
### Knowledge graph and search [#knowledge-graph-and-search]
### Agents [#agents]
### Projects and deploys [#projects-and-deploys]
Also: project secrets and variables, members, domains, shared ports and webhooks under `/v1/projects/{project_id}/...`.
## Next steps [#next-steps]
- [SDK quickstart](/docs/developers) to use the API from Python.
- [Errors](/docs/developers/errors) for status codes and retries.
- [Limits and rate limits](/docs/developers/limits) for what your plan allows.