> ## 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.

# Restore Tool

> Requires tools:update. Puts an archived workflow tool back, switched on, exactly as it was archived - its revisions, bindings and history were kept. Agents whose steps bind it can be published and duplicated again. Restoring a tool that is not archived is harmless and answers restored=false. Takes no body - send none, or {}; any field is refused by name with 422 WORKFLOW_TOOL_REQUEST_INVALID.

Requires `tools:update`. Puts an archived workflow tool back: it is offered again wherever a tool is picked, and every agent whose workflow still has a step bound to it can be published and duplicated again. Nothing else changes. Its revisions, bindings and history were kept while it was archived, so the tool comes back exactly as it was, switched on.

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

The answer is the tool, as [`GET /tools/{id}`](https://docs.goyappr.com/api-reference/tools/get) returns it, with one more field:

```json theme={null}
{
  "id": "0d96fed5-7a1e-4c55-9d5e-3f1b2c4d5e6f",
  "name": "Patient lookup",
  "is_active": true,
  "workflow_version": "workflow_v1",
  "workflow": { "status": "current", "current": { "revision_id": "cac15cd1-2b3c-4d5e-8f90-1a2b3c4d5e6f" } },
  "restored": true
}
```

`restored` is `false` when the tool was not archived: the request is harmless to repeat, and a lost response is safe to send again.

The request takes no body. Send none, or `{}`; any field is refused by name, so a setting you meant to make is never dropped in silence.

## Finding an archived tool

An archived tool is left out of both tool lists, and reads in a short form. `status=archived` lists them — on the canonical list, paged by cursor, or on the default list:

```bash theme={null}
curl "https://api.goyappr.com/tools?workflow=true&status=archived&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "data": [{
    "id": "7c1e4a52-9b3d-4f6e-8a21-5d0c3e9f1b47",
    "name": "Appointment lookup",
    "description": "Looks up a clinic appointment by reference",
    "workflow_version": "workflow_v1",
    "is_active": false,
    "created_at": "2026-09-01T09:00:00.000Z",
    "updated_at": "2026-09-20T14:30:00.000Z",
    "archived": true,
    "archived_at": "2026-09-20T14:30:00.000Z",
    "workflow": { "kind": "http" }
  }],
  "next_cursor": null
}
```

[`GET /tools/{id}`](https://docs.goyappr.com/api-reference/tools/get) answers an archived tool the same way. Its revisions are not read while it is archived; restoring it answers the whole tool again.

## When to use it

Archiving a tool that agents still bind answers with a `tool_in_use` warning naming them (see [Archive Tool](https://docs.goyappr.com/api-reference/tools/delete.md)). From then on those agents refuse to publish or duplicate with `WORKFLOW_REFERENCE_INVALID` — "Restore the tool, or remove the step". This is the restore that sentence means.

## Errors

| Status | Code | Meaning |
| - | - | - |
| 404 | `WORKFLOW_NOT_FOUND` | No workflow tool with this id in this workspace. Lost the id of an archived tool? `GET /tools?workflow=true&status=archived` lists them. |
| 409 | `WORKFLOW_TOOL_NOT_READY` | The tool's creation never built (`workflow.status: "failed"`, `workflow.current: null` on [`GET /tools/{id}`](https://docs.goyappr.com/api-reference/tools/get)), so it was never archived and there is nothing to restore. The message names its `error_code`: fix that and send the whole tool again with [`PATCH /tools/{id}`](https://docs.goyappr.com/api-reference/tools/update#a-tool-whose-creation-failed), or remove it with `DELETE /tools/{id}`. A creation still being built answers the same code; read it again with `GET /tools/{id}`. |
| 422 | `WORKFLOW_TOOL_REQUEST_INVALID` | The request carried a body. Send it with none, or `{}`. |
| 403 | `INSUFFICIENT_SCOPE` | The key lacks `tools:update`. |
| 503 | `WORKFLOW_TOOL_STORAGE_UNAVAILABLE` | Temporary. Send the same request again. |


## OpenAPI

````yaml POST /tools/{id}/restore
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}/restore:
    post:
      tags:
        - Tools
      summary: Restore tool
      description: >-
        Requires tools:update. Puts an archived workflow tool back, switched on,
        exactly as it was archived - its revisions, bindings and history were
        kept. Agents whose steps bind it can be published and duplicated again.
        Restoring a tool that is not archived is harmless and answers
        restored=false. Takes no body - send none, or {}; any field is refused
        by name with 422 WORKFLOW_TOOL_REQUEST_INVALID.
      operationId: restoreTool
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: >-
            The tool, as GET /tools/{id} answers with it, and whether it had
            been archived.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Tool'
                  - type: object
                    properties:
                      restored:
                        type: boolean
                        description: >-
                          True when the tool was archived and is now back; false
                          when it was not archived.
        '401':
          description: >-
            MISSING_KEY, INVALID_KEY or EXPIRED_KEY - the key was not accepted.
            A valid key without the scope this operation needs is 403
            INSUFFICIENT_SCOPE, naming the scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            `WORKFLOW_NOT_FOUND` - no archived tool with this id in this
            workspace, so nothing to restore. The message points at GET
            /tools?workflow=true&status=archived, which lists the archived tools
            with their ids.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowError'
        '409':
          description: >-
            `WORKFLOW_TOOL_NOT_READY` - the tool's creation never built
            (workflow.status failed, workflow.current null), so it was never
            archived and there is nothing to restore. The message names its
            error_code: fix it and send the whole tool again with PATCH
            /tools/{id}, or remove it with DELETE /tools/{id}. A creation still
            being built answers the same; read it again with GET /tools/{id}.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowError'
        '422':
          description: >-
            `WORKFLOW_TOOL_REQUEST_INVALID` - the request carried a body, and
            the route takes none. The message names the fields to remove.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowError'
        '503':
          description: >-
            `WORKFLOW_TOOL_STORAGE_UNAVAILABLE` - temporary. Send the same
            request again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowError'
components:
  schemas:
    Tool:
      oneOf:
        - $ref: '#/components/schemas/LegacyTool'
        - $ref: '#/components/schemas/WorkflowTool'
    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
    WorkflowError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          required:
            - code
          properties:
            error:
              type: string
            code:
              type: string
            warnings:
              type: array
              description: >
                On WORKFLOW_VALIDATION_FAILED from Check or publish, the
                advisories beside the issues, in the shape of
                WorkflowValidation's warnings - strict_off_guidance when
                strict_mode is off, and every advisory about a binding or an
                input. The compiler's own graph advisories
                (during_output_advisory, sequence_branch_advisory,
                before_reference_missing_fallback, override_needs_strict,
                after_ending_coverage, after_any_end_waits,
                before_budget_inbound) arrive once the document compiles.
              items:
                type: object
                required:
                  - code
                  - message
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  path:
                    type: string
                    maxLength: 1000
                  node_id:
                    type: string
                    maxLength: 64
                  label:
                    type: string
                    maxLength: 200
                    description: The step's label. Present only with node_id.
                  tool_name:
                    type: string
                    maxLength: 200
                  field:
                    type: string
                    maxLength: 200
            issues:
              type: array
              maxItems: 100
              items:
                type: object
                required:
                  - code
                  - path
                  - message
                properties:
                  code:
                    type: string
                    maxLength: 100
                  path:
                    type: string
                    maxLength: 1000
                  message:
                    type: string
                    maxLength: 2000
                  node_id:
                    type: string
                    maxLength: 64
                    description: >-
                      The step the issue belongs to - a conversation step, a
                      before-call step, a follow-up or a step inside a sequence,
                      by its `id`. An issue about a binding names the first step
                      that runs or offers it; absent only when no single step is
                      concerned (a binding no step uses, a schema).
                  label:
                    type: string
                    maxLength: 200
                    description: >-
                      That step's label, as the workflow document spells it - on
                      every code. Present only with `node_id`.
                  tool_name:
                    type: string
                    maxLength: 200
                    description: >-
                      On an issue about a binding, the name of the tool it runs.
                      `label` is never the tool's name.
                  field:
                    type: string
                    maxLength: 200
                    description: >-
                      On an issue about one input of a binding
                      (`/bindings/{n}/inputs/{field}`), that input's name.
    LegacyTool:
      type: object
      required:
        - id
        - type
      description: >-
        Temporary legacy webhook/function migration boundary. New tools use the
        workflow variant.
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          description: Normalized to camelCase (e.g. 'capture_lead' → 'captureLead')
        description:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - webhook
            - function
        config:
          type: object
          additionalProperties: true
          description: >
            Webhook configuration. Request header values are never returned: a
            read omits `config.headers` entirely and reports the names in
            `config.configured_header_names`. Writes are per header, the same
            rule a workflow tool follows — omitting `headers` keeps every stored
            header, an explicit empty object clears them all, a string sets one,
            `null` keeps the value already stored under that exact name, and a
            stored name you leave out of a `headers` you did send is removed. On
            `POST /tools` nothing is stored yet, so `null` is refused with
            `400`.

            A legacy transfer tool (made in the dashboard) carries
            `destination`, `announce_transfer` and `announce_message`, and may
            carry `transfer_method`, `pbx_feature_code` and
            `pbx_feature_code_hangup_after_secs`: the same keys, values and
            rules as on a flow's TransferNode, with `destination` in place of
            `transfer_to`.
          properties:
            configured_header_names:
              type: array
              readOnly: true
              items:
                type: string
              description: >-
                Names of the request headers this tool sends, sorted. Values are
                never returned.
        is_active:
          type: boolean
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    WorkflowTool:
      type: object
      required:
        - id
        - name
        - workflow_version
        - workflow
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        workflow_version:
          const: workflow_v1
          readOnly: true
        is_active:
          type: boolean
        created_at:
          type: string
          format: date-time
          description: >-
            When the tool was made. On a creation that has not built, when it
            was first asked for; a retry does not move it.
        integration:
          type: object
          readOnly: true
          required:
            - connection_id
            - action
          description: >-
            Present only on a tool an integration runs one of its actions
            through: the tool made for a connected account's action when that
            account is given to an agent (POST /agents/{id}/integrations). It
            names the account and the action. Such a tool belongs to the
            integration and is shared by every agent the account is given to:
            PATCH /tools/{id} answers 409 INTEGRATION_ACTION_MANAGED, DELETE
            /tools/{id} does too while any agent still uses it, and GET /tools
            leaves it out. Change which actions an agent uses with PATCH
            /agents/{id}/integrations/{integration_id}.
          properties:
            connection_id:
              type: string
              format: uuid
              description: The connected account (GET /tool-connections/{id}).
            action:
              type: string
              description: >-
                The action the tool runs, as GET /tool-connections/{id}/actions
                lists it.
              example: GOOGLECALENDAR_FIND_FREE_SLOTS
        workflow:
          type: object
          required:
            - kind
            - status
            - request_id
            - current
          properties:
            kind:
              type: string
              enum:
                - http
                - app
                - transfer
            status:
              type: string
              enum:
                - accepted
                - claimed
                - current
                - queued
                - compiling
                - ready
                - promoted
                - failed
                - conflict
            request_id:
              type: string
              format: uuid
            error_code:
              type:
                - string
                - 'null'
            head_revision_id:
              type:
                - string
                - 'null'
              format: uuid
            head_generation:
              type:
                - integer
                - 'null'
            current:
              oneOf:
                - $ref: '#/components/schemas/WorkflowToolRevision'
                - type: 'null'
            candidate:
              oneOf:
                - $ref: '#/components/schemas/WorkflowToolRevision'
                - type: 'null'
            requested:
              type:
                - object
                - 'null'
              description: >-
                Only on a creation that has not built (current is null and there
                is no head_revision_id): what it asked for, so it can be sent
                again with PATCH /tools/{id}. An app tool carries metadata_id,
                connection_id, toolkit, action, version, fixed_inputs and
                timeout_ms; a transfer tool carries destination,
                announce_transfer and announce_message. An http tool carries
                everything but its credentials: url_display (the address without
                its query, fragment or user:password), url_redacted (true when
                one of those was taken off, so the full address has to be sent
                again), method, effect, timeout_ms, include_call_context,
                input_schema, output_schema and configured_header_names (names
                only). Header values are never echoed; send them again with the
                retry.
        warnings:
          type: array
          description: >-
            Present only on a create that went through with something worth
            saying about it - today, only that another tool in this workspace
            already carries the same name. Never a refusal: the tool in the same
            response exists. Absent when there is nothing to say.
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
                enum:
                  - tool_name_in_use
              message:
                type: string
              tools:
                type: array
                description: The tools already holding the name, at most twenty.
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      format: uuid
                    name:
                      type: string
    WorkflowToolRevision:
      type: object
      description: >-
        Safe authoring projection. Raw execution contracts, provider IDs, URL
        queries, and header values are never included.
      required:
        - revision_id
        - revision
        - kind
        - name
        - description
        - input_schema
        - output_schema
        - allowed_phases
        - allowed_channels
      properties:
        revision_id:
          type: string
          format: uuid
        revision:
          type: integer
          minimum: 1
        kind:
          type: string
          enum:
            - http
            - app
            - transfer
        name:
          type: string
        description:
          type: string
        input_schema:
          type: object
          additionalProperties: true
        output_schema:
          type: object
          additionalProperties: true
        allowed_phases:
          type: array
          items:
            type: string
            enum:
              - before
              - during
              - after
        allowed_channels:
          type: array
          items:
            enum:
              - phone
              - web
            type: string
        timeout_ms:
          type: integer
        effect:
          type: string
          enum:
            - read
            - write
            - terminal
        configuration:
          type: object
          description: >-
            HTTP display only. Never use this projection as the replacement
            execution configuration.
          properties:
            method:
              type: string
            url_display:
              type: string
              description: >-
                Non-executable URL display label without userinfo, query, or
                fragment.
            url_redacted:
              type: boolean
              description: >-
                True when the saved URL carries a query string that this
                projection strips.
            url_replacement_required:
              const: true
              description: >
                Always true, for every HTTP tool, on every read. It states a
                rule rather than a condition - because this projection is lossy,
                a revision that changes the URL must send the whole URL again,
                query string included; omit the field to keep the saved one.
                Never send url_display back as the replacement URL.
            configured_query_names:
              type: array
              items:
                type: string
              description: >-
                Names of the query parameters configured on the saved URL.
                Values are never returned.
            configured_header_names:
              type: array
              items:
                type: string
            empty_header_names:
              type: array
              items:
                type: string
              description: >-
                Present only when some are - the headers whose saved value is
                empty. A tool a Duplicate with fork_tools made for the copy has
                every header this way until the values are sent with PATCH
                /tools/{id}. Values are never returned.
            empty_query_names:
              type: array
              items:
                type: string
              description: >-
                Present only when some are - the query parameters on the saved
                URL written name= with nothing after the =. A forked tool keeps
                the source's query names this way. Send the whole URL with PATCH
                /tools/{id} to fill them.
        metadata_id:
          type: string
          format: uuid
        connection_id:
          type: string
          format: uuid
        connection_label:
          type: string
        connection_ready:
          type: boolean
        toolkit:
          type: string
        action:
          type: string
        version:
          type: string
          pattern: ^\d{8}_\d{2}$
        fixed_inputs:
          type: object
          additionalProperties: true
        destination:
          type: string
        announce_transfer:
          type: boolean
        announce_message:
          type: string
        transfer_method:
          type: string
          enum:
            - pbx_feature_code
          description: >-
            A transfer tool only, and present only when it carries a [transfer
            code](/concepts/sip-trunks#hand-the-call-to-your-phone-system-with-its-transfer-code)
            of its own, which it uses instead of the one set on the extension
            endpoint: one set with workflow.transfer_method on a create or an
            update, or one a transfer tool brought with it when its agent moved
            to a workflow. Comes with pbx_feature_code. Absent when the tool
            uses the endpoint's code.
        pbx_feature_code:
          type: string
          description: >-
            Present with transfer_method: the tool's own in-call transfer code,
            for example ## or *2, sent as key presses before the extension.
        pbx_feature_code_hangup_after_secs:
          type: integer
          minimum: 1
          maximum: 10
          description: >-
            Present only with transfer_method and pbx_feature_code, when the
            tool's own code starts an attended transfer: Yappr hangs up this
            many seconds after the code.
  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.