Secrets
Store an API key, token, password or signing key without putting its value in your resource configuration. Create the secret once and bind its id to a custom API, MCP server or webhook slot. Platica stores the encrypted value in the workspace.
Quick example
# 1. Create the secret
curl -X POST https://api.platic.ai/v1/secrets \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "ERP token", "kind": "bearer", "value": "my-secret-token"}'
# 2. Bind it to a slot
curl -X POST https://api.platic.ai/v1/tools/apis/$API_ID/secrets \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"slot": "auth.token", "secretId": "'"$SECRET_ID"'"}' // 1. Create the secret (the value goes in here and no operation returns it)
const secret = await platic.secrets.create({
name: 'ERP token',
kind: 'bearer',
value: process.env.ERP_TOKEN!
});
// 2. Bind it to a slot of your API, MCP server, or webhook
await platic.tools.apis.bindSecret(apiId, { slot: 'auth.token', secretId: secret.id });
// 3. To rotate the credential without changing configurations
await platic.secrets.rotate(secret.id, process.env.ERP_NEW_TOKEN!); What you need to know
- The value goes in and never comes out: it is only sent when you create or rotate. If you lose it, rotate the secret.
- Common slots:
auth.token,auth.password,auth.value,encryptPayload.key,auth.clientSecret,webhook.secret,header:<lowercase-name>, andvariable:<name>. You can also bind when you create or edit the resource by sending"secrets": { "<slot>": "<secretId>" }. - Authorization per destination (
https): when you bind, the secret is authorized only for the resource's currenthttpsorigin. If you edit an API or MCP server (or change a webhook's domain), the slot goes toneeds_authorizationand you must bind it again. - Secret states:
active(usable untilexpiresAt),revoked(blocked, record kept), anddeleting. - Permissions: with an API key you have full access; with OAuth, the secrets permissions apply (view, manage, and use) plus
platica:write.
Slot states
state | What it means | What to do |
|---|---|---|
authorized | Secret bound and ready | Nothing |
needs_authorization | The configuration changed, or the secret was revoked or deleted | Bind the slot again |
missing | A secret has not been bound | Bind one |
legacy | Credential stored in the previous format (still works) | Optional: migrate to a secret |
bound | Bound without checking authorization (only in reads with a limited role) | Nothing |
Endpoints
| Method | Endpoint | What it does |
|---|---|---|
GET | /v1/secrets | List the workspace's secrets |
POST | /v1/secrets | Create a secret |
GET | /v1/secrets/{secretId} | See metadata and where it is used |
PATCH | /v1/secrets/{secretId} | Change the name or expiration |
POST | /v1/secrets/{secretId}/rotate | Replace the value |
POST | /v1/secrets/{secretId}/revoke | Revoke without deleting the record |
DELETE | /v1/secrets/{secretId} | Delete the secret and its authorizations |
Errors
Errors follow the format in Errors: { code, error, details: { code, message, ... } }. These are the details.code values of this section; each page says which ones it can answer.
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | The body or parameters fail validation, or the credential covers several workspaces and workspace is missing. details.issues has the list of problems |
401 | UNAUTHENTICATED | The credential is missing, revoked, or expired |
400 | INVALID_EXPIRY | expiresAt is not in the future |
400 | INVALID_CURSOR | pageToken is not a nextPageToken of this list |
403 | FORBIDDEN | The person behind the token cannot manage secrets |
404 | SECRET_NOT_FOUND | The secret does not exist in this workspace or was already deleted |
409 | SECRET_CHANGED | Another change arrived at the same time. Repeat the call |
409 | SECRET_USE_REVOKED | The secret is revoked, expired, or being deleted |
503 | SECRET_KEYRING_UNAVAILABLE | The secrets store is not responding. Try later |
503 | OPERATION_UNCONFIRMED | The change could not be confirmed. Get the secret before retrying |
AI tools are in Secrets MCP.