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 (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>, and variable:<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 current https origin. If you edit an API or MCP server (or change a webhook's domain), the slot goes to needs_authorization and you must bind it again.
  • Secret states: active (usable until expiresAt), revoked (blocked, record kept), and deleting.
  • Permissions: with an API key you have full access; with OAuth, the secrets permissions apply (view, manage, and use) plus platica:write.

Slot states

stateWhat it meansWhat to do
authorizedSecret bound and readyNothing
needs_authorizationThe configuration changed, or the secret was revoked or deletedBind the slot again
missingA secret has not been boundBind one
legacyCredential stored in the previous format (still works)Optional: migrate to a secret
boundBound without checking authorization (only in reads with a limited role)Nothing

Endpoints

MethodEndpointWhat it does
GET/v1/secretsList the workspace's secrets
POST/v1/secretsCreate 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}/rotateReplace the value
POST/v1/secrets/{secretId}/revokeRevoke 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.

Statusdetails.codeWhen it happens
400INVALID_REQUESTThe body or parameters fail validation, or the credential covers several workspaces and workspace is missing. details.issues has the list of problems
401UNAUTHENTICATEDThe credential is missing, revoked, or expired
400INVALID_EXPIRYexpiresAt is not in the future
400INVALID_CURSORpageToken is not a nextPageToken of this list
403FORBIDDENThe person behind the token cannot manage secrets
404SECRET_NOT_FOUNDThe secret does not exist in this workspace or was already deleted
409SECRET_CHANGEDAnother change arrived at the same time. Repeat the call
409SECRET_USE_REVOKEDThe secret is revoked, expired, or being deleted
503SECRET_KEYRING_UNAVAILABLEThe secrets store is not responding. Try later
503OPERATION_UNCONFIRMEDThe change could not be confirmed. Get the secret before retrying

AI tools are in Secrets MCP.