Create a secret
SDK platic.secrets.create()
Stores a credential as a workspace secret and returns its id. You send the value only when creating or rotating it. Then bind that id to the credential field (slot) of the resource that will use it.
Warning
Do not log or display the value after sending it. If an AI assistant creates the secret for you, the value goes through that conversation: to avoid it, create the secret from Platica and bind it by its id.
Example
curl https://api.platic.ai/v1/secrets \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Orders API", "kind": "api_key", "value": "your-api-key" }' await platic.secrets.create({ name: "Orders API", kind: "api_key", value: "your-api-key" }); Request body
| Field | Type | Description | Required |
|---|---|---|---|
name | string | Name to recognize it, 1 to 150 characters | ✓ |
kind | string | What the value is: api_key, bearer, password, or signing_key. It does not change how it is sent | ✓ |
value | string | The credential. 1 to 16,384 characters | ✓ |
expiresAt | string | A future date in ISO 8601 with a time zone. At that moment the secret stops working | — |
{
"name": "Acme Store · Orders API",
"kind": "bearer",
"value": "sk_test_example",
"expiresAt": "2027-01-31T06:00:00.000Z"
} Response
201 Created. The response has the secret's details, never the value.
{
"status": "success",
"message": "Secret created successfully",
"data": {
"id": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c",
"name": "Acme Store · Orders API",
"kind": "bearer",
"status": "active",
"revision": 1,
"createdAt": "2026-10-28T12:05:00.000Z",
"updatedAt": "2026-10-28T12:05:00.000Z",
"expiresAt": "2027-01-31T06:00:00.000Z",
"nextStep": "Bind it to the slot that needs it with POST /v1/tools/apis/{integrationId}/secrets (custom API) or POST /v1/tools/mcp/{mcpId}/secrets (MCP server) and { \"slot\": \"<slot>\", \"secretId\": \"5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c\" }. The slots of a tool are listed in its \"secrets\". A webhook takes it in \"secrets\" when you create or update it."
}
} Response fields
| Field | Type | Description |
|---|---|---|
id | string | Id of the secret. It is what you bind to a slot; it is not the value |
name | string | The name you sent |
kind | string | The type you sent |
status | string | active when created |
revision | number | 1 when created. Goes up with every change |
createdAt, updatedAt | string | null | Dates in ISO 8601 |
expiresAt | string | Only appears if you sent an expiration |
nextStep | string | English text that says what comes next: bind the secret to a slot. It is for people and assistants; do not program against its wording |
Errors
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | A field is missing, kind is not valid, or expiresAt is not an ISO 8601 date. details.issues has the list of problems, without repeating the value |
400 | INVALID_EXPIRY | expiresAt is not in the future |
403 | FORBIDDEN | The person behind the token cannot manage secrets |
Notes
- Continue by binding it: to an API, to an MCP server, or to a webhook. You can also send
"secrets": { "<slot>": "<secretId>" }when you create or update the resource. - To change the value later, use rotate a secret.