> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goyappr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Tool Test

> Requires tools:update. Cancels future dispatch without undoing an action already started. Terminal results and receipts are retained; no retry is created. Cancelling is idempotent and takes no body, so beyond the account-wide 401 it answers only 200, 403, 404 and 503 — an already-finished test comes back as its saved state, not as a conflict.

Requires `tools:update` for the exact workspace/tool/test. Returns the saved test state. Repeated cancellation is safe and does not create a retry.

```bash theme={null}
curl -X POST https://api.goyappr.com/tools/TOOL_ID/tests/TEST_ID/cancel \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-company-id: COMPANY_ID"
```

Cancellation prevents new dispatch but cannot undo an effect already started. Immutable preparation, attempts, receipts and terminal history are retained.

Cancelling takes no body and no `Idempotency-Key`, so beyond the account-wide `401` (missing, invalid or expired key, or a key without `tools:update`) it has only four failures: `403 WORKFLOW_TOOL_TEST_DENIED`, `404 WORKFLOW_TOOL_TEST_NOT_FOUND` (check both ids), `404 WORKFLOW_TOOL_ARCHIVED` (the tool is archived, so a test of it cannot be cancelled; a test it already ran still reads with [`GET /tools/{id}/tests/{test_id}`](https://docs.goyappr.com/api-reference/tools/test-get) — [restore it](https://docs.goyappr.com/api-reference/tools/restore.md) to test it again) and `503 WORKFLOW_TOOL_TEST_UNAVAILABLE` (retry). A test that has already finished is not a conflict — you get its saved state back, so read it with [`GET /tools/{id}/tests/{test_id}`](https://docs.goyappr.com/api-reference/tools/test-get) to see where it ended up. See [Error Codes](https://docs.goyappr.com/api-reference/errors.md).


## OpenAPI

````yaml POST /tools/{id}/tests/{test_id}/cancel
openapi: 3.1.0
info:
  title: Yappr API
  description: >
    Create and manage AI voice agents, purchase phone numbers, configure tools,
    and initiate calls — all via REST.
  version: 1.0.0
  contact:
    url: https://goyappr.com
servers:
  - url: https://api.goyappr.com
    description: Production
security:
  - apiKey: []
paths:
  /tools/{id}/tests/{test_id}/cancel:
    post:
      tags:
        - Tools
      summary: Cancel a pending tool test
      description: >-
        Requires tools:update. Cancels future dispatch without undoing an action
        already started. Terminal results and receipts are retained; no retry is
        created. Cancelling is idempotent and takes no body, so beyond the
        account-wide 401 it answers only 200, 403, 404 and 503 — an
        already-finished test comes back as its saved state, not as a conflict.
      operationId: cancelWorkflowToolTest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            format: uuid
        - in: path
          name: test_id
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Idempotent saved test state after cancellation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowToolTest'
        '401':
          description: MISSING_KEY, INVALID_KEY or EXPIRED_KEY - the key was not accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            INSUFFICIENT_SCOPE — the key does not hold tools:update, and the
            message names it. WORKFLOW_TOOL_TEST_DENIED — this key is not
            authorized for the workspace that owns the test.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            WORKFLOW_TOOL_TEST_NOT_FOUND — that tool and test pair is not in
            this workspace. Check both ids. WORKFLOW_TOOL_ARCHIVED — the tool is
            archived, so it has no test to cancel; restore it with POST
            /tools/{id}/restore.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            WORKFLOW_TOOL_TEST_UNAVAILABLE — tool testing is off for this
            workspace, or temporarily unavailable; retry the same request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    WorkflowToolTest:
      type: object
      required:
        - test_id
        - run_id
        - tool_id
        - revision_id
        - phase
        - channel
        - policy
        - status
        - redaction
      properties:
        test_id:
          type: string
          format: uuid
        run_id:
          type: string
          format: uuid
          description: >-
            Shared journal identity only; this ID does not grant access to call
            history.
        tool_id:
          type: string
          format: uuid
        revision_id:
          type: string
          format: uuid
        phase:
          type: string
          enum:
            - before
            - during
            - after
        channel:
          enum:
            - phone
            - web
          type: string
        policy:
          type: string
          enum:
            - mock
            - allowlist
        status:
          type: string
          enum:
            - accepted
            - prepared
            - running
            - succeeded
            - failed
            - blocked
            - pending
            - unknown
            - cancelled
          description: >
            `blocked` — nothing was sent. `failed` — the endpoint refused it, or
            answered 2xx with a body the tool could not use; its delivery reads
            `failed` too. `unknown` — no answer came back; its delivery reads
            `unknown` too.
        created_at:
          type: string
          format: date-time
        deadline_at:
          type: string
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
        error_code:
          type:
            - string
            - 'null'
          description: >-
            Why a settled test did not succeed — the same code as
            `outcome.error_code` once its request has settled.
        invocation_id:
          type:
            - string
            - 'null'
        attempt_id:
          type:
            - string
            - 'null'
          format: uuid
        receipt_id:
          type:
            - string
            - 'null'
        receipt_settled_test:
          type: boolean
          description: >-
            Distinguishes the receipt that settled this test from a later
            receipt.
        resolution:
          type:
            - string
            - 'null'
          enum:
            - manual_reconciliation_required
            - null
          description: >-
            Set only when no answer came back (a timeout or dropped connection);
            an endpoint that answered with an error settles failed with no
            resolution.
        replayed:
          type: boolean
        delivery_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            The delivery this real HTTP test's request made (GET
            /deliveries/{id}), with the same verdict; POST
            /deliveries/{id}/retry sends it again. Null when no request left
            (mock, connected-app action, refused before sending) and on tests
            settled before 2026-09-25.
        outcome:
          type:
            - object
            - 'null'
          description: >-
            Bounded redacted display projection, never raw vendor evidence or an
            execution input. A late outcome does not rewrite settled test
            status. An endpoint that answered with an error (4xx or 5xx) reads
            status and effect_status failed with error_code
            downstream_http_error and its http_status. One that answered 2xx
            with a body the tool could not use reads status failed,
            effect_status succeeded, and error_code output_schema_invalid,
            invalid_json_response or response_too_large (a body over 256 KB, or
            one with more values than Yappr holds that no cut can fit).
            `blocked` means nothing was sent.
          properties:
            status:
              type: string
              enum:
                - succeeded
                - failed
                - blocked
                - pending
                - unknown
            effect_status:
              type: string
              enum:
                - not_dispatched
                - succeeded
                - failed
                - pending
                - unknown
            output:
              description: Redacted typed JSON display value.
            error_code:
              type:
                - string
                - 'null'
            http_status:
              type:
                - integer
                - 'null'
            retryable:
              const: false
              description: >-
                Yappr never sends a tool's request again on its own. To send it
                again, retry the delivery named by delivery_id.
            output_fields:
              type: array
              maxItems: 10
              description: >
                Only on `output_schema_invalid`, and only when the engine could
                name them: each Output field the tool declares that the answer
                left out (`missing`) or did not match (`mismatched`) - the name
                from the tool's own schema, never a value from the answer.
                Absent when the answer as a whole was wrong (not an object).
              items:
                type: object
                required:
                  - name
                  - problem
                properties:
                  name:
                    type: string
                  problem:
                    type: string
                    enum:
                      - missing
                      - mismatched
            output_trimmed:
              type: array
              maxItems: 10
              description: >
                Only when the answer was larger than Yappr can hold (more than
                4,096 values, or a list of more than 256 items) and was cut
                instead of refused: each list that shows only its first items.
                The agent is told the same, so it says there is more rather than
                reading a partial list as the whole, and a rule or a later step
                never reads a cut list, or an item past the cut, as if it were
                whole. Structure only, never a value from the answer; absent
                when the answer was held whole. Only a tool the agent calls
                during the conversation is cut: an answer to a step before or
                after the call, to a step inside a sequence, or to the calendar
                availability check is refused as before.
              items:
                type: object
                required:
                  - path
                  - kept
                  - of
                properties:
                  path:
                    type: string
                    description: >-
                      JSON Pointer to the list inside `output`; the empty string
                      when `output` itself is the list. A key that is not a
                      plain identifier (letters, digits, `_`, `-`) is shown as
                      `*`.
                  kept:
                    type: integer
                    minimum: 1
                    description: >-
                      How many items the agent receives - the first ones,
                      unedited. The `output` a test displays is shortened
                      separately for display (its lists show at most 64 items),
                      so it can show fewer.
                  of:
                    type: integer
                    minimum: 2
                    description: How many items the endpoint or app sent.
        redaction:
          type: object
          required:
            - version
            - redacted
            - truncated
          properties:
            version:
              const: execution-outcome-v1
            redacted:
              type: boolean
            truncated:
              type: boolean
    Error:
      type: object
      required:
        - error
        - code
      description: >
        Every error response - the secret-key API and the browser data plane
        alike - carries a

        human-readable `error` and a stable machine `code`, and a refusal that
        names what is

        wrong with the request carries `issues[]` too. Branch on `code`, never
        on the `error`

        text. A refusal that names nothing more specific carries the code its
        status means:

        `BAD_REQUEST` (400), `UNAUTHORIZED` (401, the browser data plane; the
        secret-key API

        answers `MISSING_KEY`, `INVALID_KEY` or `EXPIRED_KEY`), `BILLING_ERROR`
        (402),

        `FORBIDDEN` (403), `NOT_FOUND` (404), `METHOD_NOT_ALLOWED` (405),
        `CONFLICT` (409),

        `GONE` (410), `PAYLOAD_TOO_LARGE` (413), `UNSUPPORTED_MEDIA_TYPE` (415),

        `UNPROCESSABLE_REQUEST` (422), `RATE_LIMIT` (429), `INTERNAL_ERROR`
        (500),

        `UPSTREAM_ERROR` (502), `SERVICE_UNAVAILABLE` (503), `UPSTREAM_TIMEOUT`
        (504). Some

        refusals add members of their own beside these (a call request's
        `status`, a workflow's

        `current_version`); the operation says which.
      properties:
        error:
          type: string
          description: The refusal, in one sentence for a person. Its wording may change.
        code:
          type: string
          description: The stable code to branch on.
        issues:
          type: array
          description: >
            Each thing at fault, on a 400 or 422 that names them: every query
            parameter or body field, not just the first. `path` is the
            parameter's name or the field's location.
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
                description: >-
                  query_param_unknown, query_param_repeated, query_param_blank,
                  query_param_invalid, field_unknown, field_required,
                  field_invalid, or the route's own word.
              path:
                type: string
              message:
                type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Your Yappr API key (e.g. `ypr_live_...`). Generate one in the dashboard
        under **Settings → API Keys**. No key is `401 MISSING_KEY`; a key that
        is not one of ours, or is revoked, is `401 INVALID_KEY`; an expired one
        is `401 EXPIRED_KEY`. A valid key without the scope an operation needs
        is `403 INSUFFICIENT_SCOPE` on every operation, and the message names
        the scope. Every response, a 401 included, carries X-RateLimit-Limit,
        X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a
        minute per API key. Every 429, whatever its code, carries Retry-After
        (whole seconds, never zero): the per-key budget's `RATE_LIMIT` asks for
        what is left of the minute, a route's daily cap (`RATE_LIMITED`) for the
        time until that cap resets. All four headers are listed in
        Access-Control-Expose-Headers, so a browser can read them. A path the
        API does not serve (an unknown sub-path, an id left empty) is `404
        ROUTE_NOT_FOUND`, and a method a served path does not take is `405
        METHOD_NOT_ALLOWED` with an `Allow` header; both are answered before any
        scope check, and nothing is read or changed. A trailing slash is ignored
        where it cannot be an id left empty (`POST /calls/` is `POST /calls`)
        and refused where it can (`GET /calls/`). A doubled slash inside a path
        is merged into one before the request reaches the API (`GET //calls` is
        `GET /calls`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.