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.

Example

await platic.tools.apis.test("api_123");

Path parameters

ParameterTypeDescriptionRequired
integrationIdstringCustom API ID✓

Request body

{
  "dryRun": false,
  "input": {
    "orderId": "MX-48210"
  },
  "context": {
    "phoneNumber": "+5215512345678"
  }
}
FieldTypeDescriptionRequired
dryRunbooleantrue builds the request without sending it. Default, false—
inputobjectValues for the variables in ai mode—
contextobjectTest 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

FieldTypeDescription
successbooleanWhether the call succeeded
outcomestringsuccess, 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)
httpStatusnumber | nullStatus your endpoint answered
durationMsnumberDuration of the call
errorstring | nullReason when it did not finish well
warningsstring[]Warnings, for example a test contact that was not found
preparedRequestobject | nullThe request built: method, url, headers, sentBody and authSummary. Credentials come as [REDACTED]
responseRawanyWhat your endpoint answered
extractedanyWhat the agent would receive, after applying response
fileobject | nullThe stored file's descriptor, when the response was a file
dryRunbooleanThe mode it ran in
verifiedbooleantrue only in a real test that finished well
nextStepstringText 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

Statusdetails.codeWhen
400INVALID_REQUESTThe body fails validation. details.issues has the list of problems
403FORBIDDENThe person behind the token does not have access to Integrations
404NOT_FOUNDThe API does not exist in this workspace
409SECRET_AUTHORIZATION_REQUIREDA secret is missing on a secret variable
400 or 409A SECRET_… codeA bound secret is no longer authorized for the current configuration. Check secrets[] and bind the slots in needs_authorization again
409RESOURCE_CHANGEDThe API changed during the test. Repeat the call
409AUTHORIZATION_CHANGEDA 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.timeoutMs time to answer, up to 60 seconds.