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

# Create a play

> Creates a draft: it runs nothing. The body is the plays contract the app's agent uses. `defaulted` names the parts left to their default.



## OpenAPI

````yaml /openapi.yaml post /v1/plays
openapi: 3.1.0
info:
  title: Retriever Public API
  version: 1.0.0
  description: >
    Retriever public API: start the prospecting agent (runs), read and export

    tables, import data, sync exclusion lists, run structured research (Go),

    and call atomic services.


    **Model Context Protocol (MCP)**: the same account and credits are available

    through the hosted MCP server (`POST /mcp`, Streamable HTTP). See the MCP

    guide in this documentation (Model Context Protocol navigation). Primary

    tools: `service_discover`, `service_execute`, `service_batch_execute` and

    `service_batch_get` (the slow services), `retriever_build_list_*`,

    `retriever_research_*`, `workspace_list`, `table_*`, `exclusion_*`,

    `credits`, `sequence_*`, `sender_*`, `inbox_*`.


    **Authentication**: `Authorization: Bearer ret_live_…`. Create the key in
    the

    app: Settings → **API keys** → **Create API key**. The key grants access to

    resources in the key owner's organization.


    **Errors**: every HTTP error has the shape

    `{ "error": { "code": "…", "message": "…", "details": … } }`.

    Branch your code on `error.code` (stable), never on `message`.


    **Rate limits**: key-authenticated responses include

    `RateLimit-Limit`, `RateLimit-Remaining`, and `RateLimit-Reset` (seconds).

    A `429` response also includes `Retry-After` (seconds).

    Any key-authenticated operation can also answer `503` with code

    `key_check_busy` (see `components.responses.KeyCheckBusy`): the key could

    not be checked right now, often a key created a moment ago during a flood

    of unknown keys. Retry after `Retry-After` seconds.


    **Request size**: a request body can be at most 10 MiB (10,485,760

    bytes), and 25 MiB (26,214,400 bytes) on a table import. A larger body

    gets `413 body_too_large`.


    API error messages are in English.
  contact:
    name: Retriever
servers:
  - url: https://api.retriever.run
    description: Production
  - url: http://localhost:4320
    description: Local app-server
security:
  - bearerAuth: []
tags:
  - name: Runs
    description: Prospecting agent « prompt in, table out ». Asynchronous.
  - name: Tables
    description: Read live tables in a workspace.
  - name: Workspaces
    description: Create workspaces and import tables.
  - name: Exclusions
    description: Company and people lists to never source.
  - name: Scheduled runs
    description: Repeat a list-building mission on a cadence.
  - name: Plays
    description: Find, qualify and contact leads on a cadence, and sort them.
  - name: Go
    description: >-
      One question, one structured answer: the Go agent searches the web and can
      call every Retriever service.
  - name: Services
    description: Atomic services (search, scraping, email…).
  - name: Credits
    description: Credit balance.
paths:
  /v1/plays:
    post:
      tags:
        - Plays
      summary: Create a play
      description: >-
        Creates a draft: it runs nothing. The body is the plays contract the
        app's agent uses. `defaulted` names the parts left to their default.
      operationId: createPlay
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlayDraft'
      responses:
        '201':
          description: The draft, with `defaulted`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Play'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    PlayDraft:
      type: object
      required:
        - name
        - signal
        - segment
        - whoToTarget
      additionalProperties: false
      description: >-
        The plays contract (`playDraftSchema` in app-core). Each field left out
        takes its default: review before sending, a run every day at 07:00, 10
        leads per run, the channel's usual steps.
      properties:
        name:
          type: string
          maxLength: 120
        signal:
          type: string
          maxLength: 600
          description: The moment that makes an account worth contacting now.
        segment:
          type: string
          maxLength: 600
          description: The accounts the play keeps.
        whoToTarget:
          type: string
          maxLength: 300
          description: The person to reach at each kept account.
        why:
          type: string
          maxLength: 400
        context:
          type: array
          maxItems: 8
          items:
            type: string
            maxLength: 120
        sequence:
          type: object
          required:
            - channel
          properties:
            channel:
              type: string
              enum:
                - linkedin
                - email
                - both
            steps:
              type: array
              minItems: 1
              maxItems: 8
              items:
                type: object
                required:
                  - kind
                  - delayDays
                  - label
                properties:
                  kind:
                    type: string
                    enum:
                      - email
                      - linkedin_invite
                      - linkedin_message
                  delayDays:
                    type: integer
                    minimum: 0
                    maximum: 60
                  label:
                    type: string
                    maxLength: 200
                  instructions:
                    type: string
                    maxLength: 1500
        delivery:
          type: object
          properties:
            mode:
              type: string
              enum:
                - review
                - auto
            cadence:
              type: object
              properties:
                everyDays:
                  type: integer
                  minimum: 1
                  maximum: 30
                time:
                  type: string
                  example: '07:00'
            notify:
              type: object
              properties:
                email:
                  type: boolean
                slack:
                  type: boolean
                crm:
                  type: boolean
            noEmail:
              type: string
              enum:
                - linkedin
                - skip
        limits:
          type: object
          properties:
            targetQualifiedLeadsPerRun:
              type: integer
              minimum: 1
              maximum: 100
            maxCreditsPerRun:
              type: integer
              minimum: 1
              maximum: 1000
    Play:
      allOf:
        - $ref: '#/components/schemas/PlaySummary'
        - type: object
          properties:
            workspace_id:
              type:
                - string
                - 'null'
            schedule_id:
              type:
                - string
                - 'null'
              description: >-
                Its scheduled run once launched: `GET
                /v1/scheduled-runs/{id}/runs` lists the runs.
            config:
              type: object
              description: >-
                The blocks: signal, segment, whoToTarget, why, context,
                sequence, delivery. Same shape as `PlayDraft`.
            limits:
              type: object
              properties:
                targetQualifiedLeadsPerRun:
                  type: integer
                maxCreditsPerRun:
                  type: integer
            leads:
              type: object
              properties:
                to_review:
                  type: integer
                accepted:
                  type: integer
                rejected:
                  type: integer
                in_sequence:
                  type: integer
            left_aside:
              type: integer
              description: Qualified people of its table it cannot reach as it is set.
            missing_accounts:
              type: array
              items:
                type: string
                enum:
                  - email
                  - linkedin
              description: >-
                Channels no connected account can send from: nothing leaves on
                them.
    PlaySummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - draft
            - active
            - paused
            - archived
        origin:
          type: string
          enum:
            - onboarding
            - app
        launched:
          type: boolean
        version:
          type: integer
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        links:
          type: object
          properties:
            self:
              type: string
            leads:
              type: string
            app:
              type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable code; use in your application.
            message:
              type: string
              description: Human-readable explanation. May change.
            details:
              description: Optional details (e.g. list of invalid fields).
  responses:
    BadRequest:
      description: >-
        `invalid_request`: unreadable JSON, unknown field or query parameter,
        wrong type, `limit` out of range, empty `Idempotency-Key`, invalid
        `output` contract. `message` names each invalid field; `details` lists
        them as `{ path, message }`. On `POST /v1/runs`, `workspace_mismatch`:
        the conversation does not belong to the provided workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_request
              message: 'prompt: prompt must not be blank'
              details:
                - path: prompt
                  message: prompt must not be blank
    Unauthorized:
      description: >-
        `not_authenticated`: missing header, malformed (expected `Bearer
        <key>`), revoked or unknown key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_authenticated
              message: A valid API key is required.
    UnsupportedMediaType:
      description: '`invalid_request`: add `Content-Type: application/json`.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_request
              message: Content-Type must be application/json.
    TooManyRequests:
      description: '`rate_limited`: wait `Retry-After` seconds, then retry.'
      headers:
        Retry-After:
          schema:
            type: integer
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded. Retry in 12 s.
  headers:
    RateLimit-Limit:
      schema:
        type: integer
      description: Window budget.
    RateLimit-Remaining:
      schema:
        type: integer
      description: Remaining requests.
    RateLimit-Reset:
      schema:
        type: integer
      description: Seconds until reset.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key `ret_live_…` created in Settings → API keys.

````

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