Skip to main content
This guide is for AI agents that need to call Encrata’s API. If you configure an agent, see For Developers.

Discovery

Fetch the auth file:
The file describes the API host, authentication header, key format, errors, and rate limits. For endpoints, use the docs index at https://docs.encrata.com/llms.txt. Send every API request to https://developer.encrata.com. encrata.com and app.encrata.com are the website and dashboard, not the API.

Minimum steps to operate

1. Find the key

The only credential is an Encrata API key: enc_ followed by 32 hexadecimal characters. Look for it in this order and stop at the first one that exists:
  1. ENCRATA_API_KEY in your process environment.
  2. A project .env file the user has told you to read.
If the key is already set, use it. Don’t ask the user for it again. Never ask for the user’s password or sign in on their behalf. Encrata has no password-login endpoint for agents.

2. If there is no key, ask the user to set one

Don’t ask the user to paste the key into the chat. Tell them:
Sign in at https://app.encrata.com, open API Keys, click Create API key and copy the key (it starts with enc_). Don’t paste it into this chat. Give the key a credit limit that fits this task. Then set it as the environment variable ENCRATA_API_KEY where I run - for example in your shell profile, an uncommitted .env file, or your tool’s secrets settings. Tell me when it’s done.
Resume the task once the key is set. Encrata keys have no permission scopes, but each key can carry a credit limit. Suggest one that covers the task, so a leaked or runaway key can’t drain the account. If the user pastes a key into the chat anyway, don’t use it. Ask them to revoke it under API Keys and set a new one as ENCRATA_API_KEY. A pasted key is now in the transcript, in any logs the user shares, and with the model provider.

3. Verify the key

Before spending credits, confirm the key works. This call is free.
A 200 means the key is valid. credits_remaining is the account balance.

4. Make API calls

Send the key as a Bearer token on every request. Read it from ENCRATA_API_KEY at the moment of the call.
  • In shell commands, reference the variable ("Authorization: Bearer $ENCRATA_API_KEY"). Never type the key itself into a command, where it lands in shell history.
  • Never put the key in a query string, a log, a commit message, a pull request, an error report, a screenshot, or anything you echo back to the user.

Available endpoints

For every other endpoint, see the docs index.

Credits

  • All keys in an account share its credits and rate limit.
  • A key can have an optional credit limit. Once reached, requests return 402.
  • Don’t retry a 402 response. Ask the user to add credits or raise the key’s limit.

Error handling

Branch on the HTTP status, then on result.code. Never branch on message. Include request_id when reporting a problem. 429 responses don’t include Retry-After. Use X-Ratelimit-Reset, which is a number of seconds, not a timestamp.

Rules

  1. Call the API at https://developer.encrata.com with the key from ENCRATA_API_KEY.
  2. Never ask for a key in chat, and never use one that was pasted there.
  3. Never request, store, or send the user’s password.
  4. Keep the key out of commands, URLs, logs, and anything you echo back. Reference $ENCRATA_API_KEY.
  5. Verify the key with /api/account/credits before spending credits.
  6. Stop on 401, 402, and 403. Back off on 429 and 5xx.

Removed access

If a key that worked before returns 401, don’t retry and don’t try to create a replacement. Drop the value you hold and ask the user to update ENCRATA_API_KEY - not to send a new key in chat.