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.

Example

await platic.secrets.create({ name: "Orders API", kind: "api_key", value: "your-api-key" });

Request body

FieldTypeDescriptionRequired
namestringName to recognize it, 1 to 150 characters✓
kindstringWhat the value is: api_key, bearer, password, or signing_key. It does not change how it is sent✓
valuestringThe credential. 1 to 16,384 characters✓
expiresAtstringA 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

FieldTypeDescription
idstringId of the secret. It is what you bind to a slot; it is not the value
namestringThe name you sent
kindstringThe type you sent
statusstringactive when created
revisionnumber1 when created. Goes up with every change
createdAt, updatedAtstring | nullDates in ISO 8601
expiresAtstringOnly appears if you sent an expiration
nextStepstringEnglish 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

Statusdetails.codeWhen it happens
400INVALID_REQUESTA 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
400INVALID_EXPIRYexpiresAt is not in the future
403FORBIDDENThe person behind the token cannot manage secrets

Notes