Custom APIs
Let an agent call a public HTTP endpoint in your service. Define the request, bind credentials as secrets, test it and publish it. Then connect the tool to the agent so it can use it. Use variables to fill the request with conversation data.
Quick example
# Cycle: create (draft) -> bind secrets -> test -> publish (enabled) -> connect to the agent
curl -X POST https://api.platic.ai/v1/tools/apis/$API_ID/test \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": {"order": "1001"}}'
curl -X POST https://api.platic.ai/v1/tools/apis/$API_ID/enable \
-H "Authorization: Bearer $PLATIC_API_KEY" // 1. Create the API as a draft
const api = await platic.tools.apis.create({
name: "order_status",
description: "Looks up an order by its number.",
request: {
method: "GET",
url: "https://api.example-store.com/orders",
params: [{ key: "number", value: "{{order}}" }],
auth: { type: "bearer" },
},
variables: [{ name: "order", type: "string", description: "Order number", required: true, mode: "ai" }],
secrets: { "auth.token": secretId },
});
// 2. Real test (required to publish) -> publish -> connect to the agent
const test = await platic.tools.apis.test(api.id, { input: { order: "1001" } });
if (test.success) {
const { toolId } = await platic.tools.apis.enable(api.id);
await platic.agents.tools.connect(agentId, toolId);
} What you need to know
- Variables (
mode):ai(the agent fills it; it generates its JSON Schema),constant(fixed value inconstantValue),context(comes from the conversation throughcontextField) andsecret(comes from thevariable:<name>slot). - Credentials in slots:
auth.token(bearer),auth.password(basic),auth.value(apikey),encryptPayload.key,header:<name>andvariable:<name>. Sending credentials inline answers400 SECRET_REFERENCE_REQUIRED. - Editing invalidates the test: when you update the API,
verifiedgoes back tofalse, secrets becomeneeds_authorizationand, if it wasenabled, it goes back todraft(keeping its connections to agents). Bind, test and publish again. - Security: public URLs only (it blocks
localhostand private networks). Binding secrets requireshttps. Sensitive values come back as"[REDACTED]".
Endpoints
| Method | Endpoint | What it does |
|---|---|---|
GET / POST | /v1/tools/apis | List APIs or create one as draft |
GET / PATCH / DELETE | /v1/tools/apis/{integrationId} | Get, edit or delete |
POST | /v1/tools/apis/{integrationId}/secrets | Bind a secret to a slot |
POST | /v1/tools/apis/{integrationId}/test | Test it (dryRun or real test) |
POST | /v1/tools/apis/{integrationId}/enable | Publish to the catalog (enabled) |
POST | /v1/tools/apis/{integrationId}/pause | Pause without losing configuration |
POST | /v1/tools/apis/{integrationId}/clone | Clone as a new draft |
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 |
|---|---|---|
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, or revoked or expired |
400 | INVALID_CONFIG | The definition is not valid, or request.url points to localhost, .local, .internal or a private IP |
400 | SECRET_REFERENCE_REQUIRED | You sent a credential inside the definition. When it applies, details.slot says the slot to bind |
400 | SECRET_SLOT_INVALID | That slot does not exist in the API's current configuration |
400 | SECRET_DESTINATION_INVALID | The API does not have a valid https URL |
400 | SECRET_VARIABLE_CONFIGURATION_INVALID | A secret variable is outside headers, query parameters or body |
403 | FORBIDDEN | The person behind the token does not have access to Integrations |
404 | NOT_FOUND | The API does not exist in this workspace |
404 | SECRET_NOT_FOUND | The secret does not exist in this workspace |
404 | CRON_NOT_FOUND | periodicAuth.cronJobId does not exist |
409 | RESOURCE_CHANGED | expectedVersion does not match, or the API changed while it was being saved. Read it and repeat |
409 | NAME_CONFLICT | The name is already used by another tool |
409 | VERIFICATION_REQUIRED | There is no valid real test. Test and repeat |
409 | SECRET_AUTHORIZATION_REQUIRED | A secret is missing on a secret variable |
409 | AUTHORIZATION_CHANGED | A secret changed during the test. Repeat the call |
409 | SECRET_USE_REVOKED | The secret is revoked or expired |
409 | SECRET_CHANGED | The secret changed while it was being bound. Repeat the call |
409 | SECRET_BINDING_LIMIT | The API already has the maximum number of bound secrets |
409 | DELETION_IN_PROGRESS | The deletion is already in progress. Repeat the call to continue it |
Slot states are in Secrets and AI tools in the Tools MCP tools.