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

# Run a tool's code

> Run the code of a tool your team built, its draft or its live version, and return the run's job.

<Accordion title="Details">
  * Business accounts only, with tools:build and runs:create. Follow the job with GET /v1/jobs/\{id}.

  * It really runs on the website, so a write tool's run changes it. Send an Idempotency-Key, as with POST /v1/runs.

  * A run that signs in needs Edit access to its login, except a run of the live HTTP version.

  * A run of the draft starts no repair.

  * **Callers:** an API key, an MCP OAuth token or a Dashboard session.

  * **Permission:** `tools:build`.

  * **Effect:** Creates or changes something.

  * **Errors:** [`idempotency_conflict`](/errors#idempotency_conflict), [`quota_exceeded`](/errors#quota_exceeded), [`quota_expired`](/errors#quota_expired), [`acceptance_unknown`](/errors#acceptance_unknown), [`not_found`](/errors#not_found), [`save_forbidden`](/errors#save_forbidden), [`account_selection_required`](/errors#account_selection_required), [`saved_login_conflict`](/errors#saved_login_conflict), [`login_identity_conflict`](/errors#login_identity_conflict), [`legacy_duplicate_saved_logins`](/errors#legacy_duplicate_saved_logins), [`saved_login_unsettled`](/errors#saved_login_unsettled), [`not_configured`](/errors#not_configured), [`invalid_input`](/errors#invalid_input), [`unsupported_login_field`](/errors#unsupported_login_field), [`file_too_large`](/errors#file_too_large), [`file_type_refused`](/errors#file_type_refused), [`file_unavailable`](/errors#file_unavailable), [`file_limit_exceeded`](/errors#file_limit_exceeded), [`file_fetch_failed`](/errors#file_fetch_failed), [`business_account_required`](/errors#business_account_required), and the [errors any request can get](/errors).
</Accordion>


## OpenAPI

````yaml /api-reference/openapi.json post /v1/code/{id}/runs
openapi: 3.1.0
info:
  title: Pomerado API
  version: '1'
  description: >-
    Run and build website tools, follow their jobs, and manage logins, API keys
    and webhooks. Authenticate with a Pomerado API key (pom_…), an MCP OAuth
    token or a Dashboard session as a Bearer token.
servers:
  - url: https://api.pomerado.ai
security: []
tags:
  - name: account
    x-group: Account
  - name: api_keys
    x-group: API keys
  - name: connected_apps
    x-group: Connected apps
  - name: usage
    x-group: Usage
  - name: quota
    x-group: Quota
  - name: billing
    x-group: Billing
  - name: integrations
    x-group: Integrations
  - name: connect
    x-group: Connect
  - name: code
    x-group: Code
  - name: logins
    x-group: Saved logins
  - name: two_factor
    x-group: 2FA
  - name: login_access
    x-group: Login access
  - name: tools
    x-group: Tools
  - name: webhooks
    x-group: Webhooks
  - name: runs
    x-group: Runs
  - name: builds
    x-group: Builds
  - name: jobs
    x-group: Jobs
  - name: files
    x-group: Files
  - name: team
    x-group: Team
paths:
  /v1/code/{id}/runs:
    post:
      tags:
        - code
      summary: Run a tool's code
      description: >-
        Run the code of a tool your team built, its draft or its live version,
        and return the run's job.
      operationId: code.run
      parameters:
        - name: id
          in: path
          required: true
          description: 'a tool ID: tool_ and 32 lowercase hex digits'
          schema:
            type: string
            examples:
              - tool_0f8e2d1c4b3a49e8a7f6e5d4c3b2a190
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Repeat a request safely: the same key and body answer the first
            request's job again with Idempotent-Replayed: true; the same key
            with a different body answers idempotency_conflict.
          schema:
            type: string
            description: 1 to 200 letters, digits, _ or -, such as a UUID
            pattern: ^[A-Za-z0-9_-]{1,200}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - input
                - draft
              properties:
                input:
                  anyOf:
                    - type: object
                    - type: array
                    - type: string
                    - type: number
                    - type: boolean
                    - type: 'null'
                login_id:
                  $ref: '#/components/schemas/login_id'
                implementation:
                  type: string
                  enum:
                    - browser
                    - http
                  description: >-
                    browser (the default) runs the tool in a browser; http runs
                    its HTTP version, for a tool that has one
                draft:
                  type: boolean
                  description: >-
                    true runs your team's draft of the tool, false the version
                    callers run now
              additionalProperties: false
      responses:
        '200':
          description: >-
            The job this Idempotency-Key already started, with
            Idempotent-Replayed: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '202':
          description: The new run's job
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '400':
          description: invalid_input, unsupported_login_field, invalid_request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: unauthorized, reauthentication_required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: save_forbidden, business_account_required, forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: not_found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            idempotency_conflict, quota_expired, account_selection_required,
            saved_login_conflict, login_identity_conflict,
            legacy_duplicate_saved_logins, saved_login_unsettled,
            file_unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: file_too_large, file_limit_exceeded, request_too_large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          description: file_type_refused
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: file_fetch_failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: quota_exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: internal_error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: not_configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: acceptance_unknown, temporarily_unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
components:
  schemas:
    login_id:
      type: string
      description: 'a saved login ID: login_ and 32 lowercase hex digits'
      examples:
        - login_0f8e2d1c4b3a49e8a7f6e5d4c3b2a190
    Job:
      type: object
      required:
        - id
        - type
        - status
        - tool_id
        - input_request
        - result
        - result_status
        - result_expires_at
        - write_status
        - login_save
        - error
        - message
        - maintenance
        - build
        - watch_url
        - created_at
        - updated_at
        - completed_at
      properties:
        id:
          $ref: '#/components/schemas/job_id'
        type:
          type: string
          enum:
            - run
            - build
        status:
          type: string
          enum:
            - queued
            - running
            - needs_input
            - succeeded
            - failed
            - cancelled
        tool_id:
          anyOf:
            - type: string
            - type: 'null'
        input_request:
          anyOf:
            - $ref: '#/components/schemas/InputRequest'
            - type: 'null'
        result:
          $id: /schemas/unknown
        result_status:
          anyOf:
            - type: string
              enum:
                - available
                - delivered
                - expired
            - type: 'null'
        result_expires_at:
          anyOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
        write_status:
          anyOf:
            - type: string
              enum:
                - not_attempted
                - may_have_applied
                - applied
                - not_applied
            - type: 'null'
        login_save:
          anyOf:
            - type: object
              required:
                - status
                - login_id
                - reason
              properties:
                status:
                  type: string
                  enum:
                    - saved
                    - not_saved
                    - failed
                login_id:
                  anyOf:
                    - type: string
                    - type: 'null'
                reason:
                  anyOf:
                    - type: string
                    - type: 'null'
              additionalProperties: false
            - type: 'null'
        error:
          anyOf:
            - $ref: '#/components/schemas/Error'
            - type: 'null'
        message:
          anyOf:
            - type: string
            - type: 'null'
        maintenance:
          anyOf:
            - type: object
              required:
                - status
                - result_recovered
                - message
                - deadline_at
              properties:
                status:
                  type: string
                  enum:
                    - repairing
                    - repaired
                    - incomplete
                result_recovered:
                  type: boolean
                message:
                  type: string
                deadline_at:
                  anyOf:
                    - type: string
                    - type: 'null'
              additionalProperties: false
            - type: 'null'
        build:
          anyOf:
            - $ref: '#/components/schemas/JobBuild'
            - type: 'null'
        watch_url:
          type: string
        tip:
          type: string
        created_at:
          $ref: '#/components/schemas/Date'
        updated_at:
          $ref: '#/components/schemas/Date'
        completed_at:
          anyOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
      additionalProperties: false
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - retryable
            - docs_url
          properties:
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            docs_url:
              type: string
            details:
              type: object
              required: []
              properties: {}
              additionalProperties:
                $id: /schemas/unknown
          additionalProperties: false
      additionalProperties: false
    job_id:
      type: string
      description: 'a job ID: job_ and 32 lowercase hex digits'
      examples:
        - job_0f8e2d1c4b3a49e8a7f6e5d4c3b2a190
    InputRequest:
      type: object
      required:
        - id
        - expires_at
        - answer_url
        - message
        - questions
      properties:
        id:
          type: string
          description: 'An input request ID: req_ and 32 lowercase hex digits'
          examples:
            - req_0f8e2d1c4b3a49e8a7f6e5d4c3b2a190
          pattern: ^req_[0-9a-f]{32}$
        expires_at:
          type: string
        answer_url:
          type: string
        message:
          type: string
        questions:
          type: array
          items:
            $ref: '#/components/schemas/Question'
      additionalProperties: false
    Date:
      type: string
      description: a string to be decoded into a Date
    JobBuild:
      type: object
      required:
        - integration_id
        - stage
        - stages
        - eta
        - example_result
        - existing_tool_id
        - change
      properties:
        integration_id:
          anyOf:
            - $ref: '#/components/schemas/integration_id'
            - type: 'null'
        stage:
          type: string
          enum:
            - queued
            - checking_login
            - exploring
            - building
            - publishing
        stages:
          type: array
          items:
            type: object
            required:
              - key
              - label
              - status
              - started_at
              - completed_at
            properties:
              key:
                type: string
                enum:
                  - queued
                  - checking_login
                  - exploring
                  - building
                  - publishing
              label:
                type: string
              status:
                type: string
                enum:
                  - done
                  - active
                  - pending
              started_at:
                anyOf:
                  - type: string
                  - type: 'null'
              completed_at:
                anyOf:
                  - type: string
                  - type: 'null'
            additionalProperties: false
        eta:
          anyOf:
            - type: object
              required:
                - min_seconds
                - max_seconds
              properties:
                min_seconds:
                  type: number
                max_seconds:
                  type: number
              additionalProperties: false
            - type: 'null'
        example_result:
          $id: /schemas/unknown
        existing_tool_id:
          anyOf:
            - type: string
            - type: 'null'
        change:
          anyOf:
            - $ref: '#/components/schemas/JobChange'
            - type: 'null'
      additionalProperties: false
    Question:
      anyOf:
        - type: object
          required:
            - id
            - prompt
            - type
            - options
            - allow_other
            - allow_note
          properties:
            id:
              type: string
            prompt:
              type: string
            type:
              type: string
              enum:
                - choice
            options:
              type: array
              items:
                type: object
                required:
                  - id
                  - label
                properties:
                  id:
                    type: string
                  label:
                    type: string
                additionalProperties: false
            allow_other:
              type: boolean
            allow_note:
              type: boolean
          additionalProperties: false
        - type: object
          required:
            - id
            - prompt
            - type
            - options
            - min_selections
            - max_selections
            - allow_other
            - allow_note
          properties:
            id:
              type: string
            prompt:
              type: string
            type:
              type: string
              enum:
                - multi_choice
            options:
              type: array
              items:
                type: object
                required:
                  - id
                  - label
                properties:
                  id:
                    type: string
                  label:
                    type: string
                additionalProperties: false
            min_selections:
              $ref: '#/components/schemas/Int'
            max_selections:
              $ref: '#/components/schemas/Int'
            allow_other:
              type: boolean
            allow_note:
              type: boolean
          additionalProperties: false
        - type: object
          required:
            - id
            - prompt
            - type
            - max_length
          properties:
            id:
              type: string
            prompt:
              type: string
            type:
              type: string
              enum:
                - text
            max_length:
              anyOf:
                - $ref: '#/components/schemas/Int'
                - type: 'null'
          additionalProperties: false
        - type: object
          required:
            - id
            - prompt
            - type
            - follow_up
          properties:
            id:
              type: string
            prompt:
              type: string
            type:
              type: string
              enum:
                - confirm
            follow_up:
              anyOf:
                - type: object
                  required:
                    - prompt
                  properties:
                    prompt:
                      type: string
                  additionalProperties: false
                - type: 'null'
          additionalProperties: false
        - type: object
          required:
            - id
            - prompt
            - type
            - kind
          properties:
            id:
              type: string
            prompt:
              type: string
            type:
              type: string
              enum:
                - secret
            kind:
              type: string
              enum:
                - one_time_code
                - authenticator_code
                - private_text
          additionalProperties: false
        - type: object
          required:
            - id
            - prompt
            - type
            - site_url
            - fields
            - reason
            - username_masked
            - can_save
          properties:
            id:
              type: string
            prompt:
              type: string
            type:
              type: string
              enum:
                - login
            site_url:
              type: string
            fields:
              type: array
              items:
                type: string
                enum:
                  - username
                  - email
                  - phone
                  - account_number
                  - password
            reason:
              type: string
              enum:
                - missing
                - rejected
                - expired
            username_masked:
              anyOf:
                - type: string
                - type: 'null'
            can_save:
              type: boolean
          additionalProperties: false
    integration_id:
      type: string
      description: 'an integration ID: int_ and 32 lowercase hex digits'
      examples:
        - int_0f8e2d1c4b3a49e8a7f6e5d4c3b2a190
    JobChange:
      type: object
      required:
        - revision_id
        - previous_revision_id
        - write_started
      properties:
        revision_id:
          anyOf:
            - type: string
            - type: 'null'
        previous_revision_id:
          anyOf:
            - type: string
            - type: 'null'
        write_started:
          type: boolean
      additionalProperties: false
    Int:
      type: integer
      description: an integer
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````

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