Test an API
SDK platic.tools.apis.test()
Check how the request is built or call the endpoint with test values. Choose one of these modes:
- Dry run (
dryRun: true): builds the request and returns it without calling your endpoint. It is useful to check how the URL, headers and body turn out. - Real (
dryRun: false, the default): calls your endpoint with the bound secrets. If it finishes well, the API is verified and can be published.
Warning
A real test calls your endpoint. If the API creates, changes or deletes data, the test does too: use test values that do not affect a customer.
Example
curl -X POST "https://api.platic.ai/v1/tools/apis/$INTEGRATION_ID/test" \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": { "order": "1001" }
}' await platic.tools.apis.test("api_123"); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
integrationId | string | Custom API ID | ✓ |
Request body
{
"dryRun": false,
"input": {
"orderId": "MX-48210"
},
"context": {
"phoneNumber": "+5215512345678"
}
} | Field | Type | Description | Required |
|---|---|---|---|
dryRun | boolean | true builds the request without sending it. Default, false | — |
input | object | Values for the variables in ai mode | — |
context | object | Test values for the variables in context mode: phoneNumber, workspaceId, conversationId, agentId, agentName, channelId, messages and contact | — |
context.contact is an object with the contact's fields. If you leave it out and send conversationId or phoneNumber, Platica loads the real contact.
Response
{
"status": "success",
"message": "Test executed",
"data": {
"success": true,
"outcome": "success",
"httpStatus": 200,
"durationMs": 412,
"error": null,
"warnings": [],
"preparedRequest": {
"method": "GET",
"url": "https://api.example-store.com/orders/MX-48210",
"headers": {
"Accept": "application/json",
"Authorization": "Bearer [REDACTED]"
},
"sentBody": null,
"authSummary": "bearer"
},
"responseRaw": {
"data": {
"status": "in_transit",
"eta": "2026-11-02",
"internal_notes": "Check packaging"
}
},
"extracted": {
"status": "in_transit",
"eta": "2026-11-02"
},
"file": null,
"dryRun": false,
"verified": true,
"nextStep": "Verified. Publish it with POST /v1/tools/apis/RuzoaswTBBrhutHyKYZn/enable."
}
} Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the call succeeded |
outcome | string | success, http-error, network-error, schema-error (response.path does not exist), mapping-error (the request could not be built), file-error or secret-in-response (your endpoint returned the credential and the response is not delivered) |
httpStatus | number | null | Status your endpoint answered |
durationMs | number | Duration of the call |
error | string | null | Reason when it did not finish well |
warnings | string[] | Warnings, for example a test contact that was not found |
preparedRequest | object | null | The request built: method, url, headers, sentBody and authSummary. Credentials come as [REDACTED] |
responseRaw | any | What your endpoint answered |
extracted | any | What the agent would receive, after applying response |
file | object | null | The stored file's descriptor, when the response was a file |
dryRun | boolean | The mode it ran in |
verified | boolean | true only in a real test that finished well |
nextStep | string | Text in English that says what comes next. Do not program against its wording |
message is Dry run completed in a dry run and Test executed in a real test.
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | The body fails validation. details.issues has the list of problems |
403 | FORBIDDEN | The person behind the token does not have access to Integrations |
404 | NOT_FOUND | The API does not exist in this workspace |
409 | SECRET_AUTHORIZATION_REQUIRED | A secret is missing on a secret variable |
400 or 409 | A SECRET_… code | A bound secret is no longer authorized for the current configuration. Check secrets[] and bind the slots in needs_authorization again |
409 | RESOURCE_CHANGED | The API changed during the test. Repeat the call |
409 | AUTHORIZATION_CHANGED | A secret changed during the test. Repeat the call |
The operation returns 200 even if your endpoint fails. In that case, it returns success: false with details in outcome, httpStatus, error and responseRaw.
Notes
- Only a real test leaves a record. A dry run does not verify the API, and neither does a real test that fails.
- The verification is valid for the configuration and the secrets it was made with. If you update the API, bind another secret or rotate one of its secrets, test again before publishing.
- You can test an API in any state, including published.
- Your endpoint has the
request.settings.timeoutMstime to answer, up to 60 seconds.