Bind a secret to an API

SDK platic.tools.apis.bindSecret()

Complete a credential slot in missing or needs_authorization. Send slot and an existing secret’s secretId; do not send its value. Find the slot in the API’s secrets[].

Example

await platic.tools.apis.bindSecret("api_123", { slot: "auth.token", secretId: "secret_123" });

Path parameters

ParameterTypeDescriptionRequired
integrationIdstringCustom API ID✓

Request body

{
  "slot": "auth.token",
  "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
}
FieldTypeDescriptionRequired
slotstringThe slot, as it appears in secrets[].slot: auth.token, auth.password, auth.value, encryptPayload.key, header:<name> or variable:<name>✓
secretIdstringSecret ID, from List secrets or Create a secret✓

Response

data has the complete API, with the fields of Get an API. The slot ends up in authorized.

{
  "status": "success",
  "message": "Secret bound successfully",
  "data": {
    "id": "RuzoaswTBBrhutHyKYZn",
    "toolName": "api_order_lookup",
    "name": "order_lookup",
    "description": "Looks up the status of an Example Store order by its number. Use it when the customer asks where their order is.",
    "status": "draft",
    "version": 2,
    "variables": [
      {
        "name": "orderId",
        "type": "string",
        "description": "Order number, as it appears in the confirmation email.",
        "required": true,
        "mode": "ai"
      }
    ],
    "request": {
      "method": "GET",
      "url": "https://api.example-store.com/orders/{{orderId}}",
      "headers": [{ "key": "Accept", "value": "application/json" }],
      "auth": { "type": "bearer" }
    },
    "createdAt": "2026-10-28T12:05:03.902Z",
    "updatedAt": "2026-10-28T12:10:02.118Z",
    "lastTest": null,
    "verified": false,
    "secrets": [
      {
        "slot": "auth.token",
        "state": "authorized",
        "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
      }
    ],
    "secretsRedacted": true,
    "nextStep": "Run a real test with POST /v1/tools/apis/RuzoaswTBBrhutHyKYZn/test and dryRun false. Enabling requires a successful real test of the current configuration."
  }
}

Errors

Statusdetails.codeWhen
400INVALID_REQUESTslot or secretId is missing. details.issues has the list of problems
400SECRET_SLOT_INVALIDThat slot does not exist in the API's current configuration
400SECRET_DESTINATION_INVALIDThe API does not have a valid https URL. Complete it before binding
400SECRET_VARIABLE_CONFIGURATION_INVALIDA secret variable is misused: it can only go in headers, query parameters or body
403FORBIDDENThe person behind the token cannot use secrets or does not have access to Integrations
404SECRET_NOT_FOUNDThe secret does not exist in this workspace
404NOT_FOUNDThe API does not exist in this workspace
409SECRET_USE_REVOKEDThe secret is revoked or expired
409SECRET_CHANGEDThe secret changed while it was being bound. Repeat the call
409RESOURCE_CHANGEDThe API changed while it was being bound. Repeat the call
409SECRET_BINDING_LIMITThe API already has the maximum number of bound secrets

Notes

  • The secret is authorized for that slot and for the API's current destination. If you later update the definition, the slot goes to needs_authorization and you have to repeat this call.
  • Binding another secret to a slot that already had one replaces it.
  • Binding changes the credentials the API was tested with. If it was already verified, test it again before publishing.
  • To bind several slots in one call, send "secrets": { "<slot>": "<secretId>" } in Update an API or in Create an API.
  • The same secret can be bound to several slots and to several resources.