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

# Create or update an opportunity by external ID

> Requires the `opportunities:write` permission.



## OpenAPI

````yaml /openapi.json put /opportunities/external/{source}/{externalId}
openapi: 3.1.0
info:
  title: Eloout API
  version: 1.1.1
  description: >-
    The Eloout public REST API. Authenticate with an organization API key
    (`Authorization: Bearer elo_…`) created in Settings → API keys.


    **Permissions.** Each operation needs one permission, listed in
    `x-eloout-required-scopes`; reading and writing are separate. A key without
    it gets 403 `FORBIDDEN` with `details.requiredScope`. `GET /me` reports a
    key's effective permissions. For the MCP server, create a key with exactly:
    `opportunities:read`, `pipelines:read`, `lists:read`, `records:read`.


    **Limits.** 120 requests per 60 s per key and 300 per 60 s per organization;
    20 failed authentications per 10 min per client IP. Bodies up to 1048576
    bytes.


    **Text limits.** Request strings are trimmed before they are checked: a
    length limit applies to the trimmed value, and the schemas express it as a
    `pattern` over that value. Lengths count Unicode characters (code points),
    as JSON Schema does.


    **Writes.** With `Idempotency-Key`, a retry of the same request with the
    same API key within 24 h gets the stored answer instead of running again;
    answers of 500 and above are not stored. `?dryRun=true` plans a write and
    changes nothing. Both only where listed.


    **Changelog.**

    - 1.1.1: descriptions corrected to match the server, no behaviour change.
    `X-RateLimit-Reset` is the number of seconds until the window resets, not a
    Unix time; the `X-RateLimit-*` headers come only on answers to an
    authenticated key; `Idempotency-Key` is 1–255 printable ASCII characters
    without spaces, and answers of 500 and above are not stored, so a retry
    after one runs the write again.

    - 1.1.0 (ELO-33): every operation requires a per-resource permission
    (`x-eloout-required-scopes`); `lists:write` is retired in favour of
    `records:write`; record endpoints need `records:read` / `records:write`
    instead of `lists:read` / `lists:write`; `GET /me` reports effective
    permissions and the `legacy` flag and no longer returns the key prefix. Keys
    created before this release were migrated to explicit permissions matching
    their previous access.

    - 1.0.0: first published contract of the existing `/api/v1` (opportunities,
    pipelines, custom fields, lists, records, webhooks).
servers:
  - url: https://app.eloout.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Account
  - name: Catalog
    description: Pipelines and opportunity custom fields (read only).
  - name: Opportunities
  - name: Lists
    description: List metadata (read only).
  - name: Records
    description: Records of a list.
  - name: Webhooks
    description: Outbound webhook subscriptions.
paths:
  /opportunities/external/{source}/{externalId}:
    put:
      tags:
        - Opportunities
      summary: Create or update an opportunity by external ID
      description: Requires the `opportunities:write` permission.
      operationId: upsertOpportunityByExternalId
      parameters:
        - name: source
          in: path
          required: true
          schema:
            type: string
          description: Ignored since ELO-8; any non-empty value.
        - name: externalId
          in: path
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/IdempotencyKey'
        - $ref: '#/components/parameters/DryRun'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpportunityUpsertBody'
      responses:
        '200':
          description: Updated, unchanged, frozen, or a dry run.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            Idempotent-Replayed:
              $ref: '#/components/headers/Idempotent-Replayed'
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                additionalProperties: false
                properties:
                  ok:
                    const: true
                  data:
                    $ref: '#/components/schemas/OpportunityWriteResult'
              examples:
                default:
                  value:
                    ok: true
                    data:
                      id: 4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c
                      result: created
                      stageId: 1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f
                      stageChange: null
                      protectedFields: []
        '201':
          description: Created.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            Idempotent-Replayed:
              $ref: '#/components/headers/Idempotent-Replayed'
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                additionalProperties: false
                properties:
                  ok:
                    const: true
                  data:
                    $ref: '#/components/schemas/OpportunityWriteResult'
              examples:
                default:
                  value:
                    ok: true
                    data:
                      id: 4f5a6b7c-8d9e-4f0a-9b2c-3d4e5f6a7b8c
                      result: created
                      stageId: 1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f
                      stageChange: null
                      protectedFields: []
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        1 to 255 printable ASCII characters without spaces, scoped to the API
        key. A retry of the same request (method, path, query and body) within
        24 h gets the stored answer with `Idempotent-Replayed: true` and does
        not run again; the same key with another request is 422; while the first
        runs, 409. Answers of 500 and above are not stored: the key is released
        and a retry runs the write again. Ignored on a dry run.
      schema:
        type: string
        maxLength: 255
    DryRun:
      name: dryRun
      in: query
      required: false
      description: >-
        `true` plans the write and answers as if done, with `dryRun: true`;
        nothing is written and no event is sent.
      schema:
        type: boolean
        default: false
  schemas:
    OpportunityUpsertBody:
      type: object
      properties:
        pipelineId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        stageId:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            - type: 'null'
        title:
          anyOf:
            - type: string
              pattern: ^\s*(?:\S(?:[\s\S]{0,498}\S)?)?\s*$
            - type: 'null'
        value:
          type:
            - number
            - string
            - 'null'
        contact:
          anyOf:
            - type: object
              properties:
                phone:
                  anyOf:
                    - type: string
                      pattern: ^\s*(?:\S(?:[\s\S]{0,38}\S)?)?\s*$
                    - type: 'null'
                name:
                  anyOf:
                    - type: string
                      pattern: ^\s*(?:\S(?:[\s\S]{0,198}\S)?)?\s*$
                    - type: 'null'
              additionalProperties: false
            - type: 'null'
        client:
          anyOf:
            - type: object
              properties:
                externalId:
                  anyOf:
                    - type: string
                      pattern: ^\s*(?:\S(?:[\s\S]{0,198}\S)?)?\s*$
                    - type: 'null'
                taxId:
                  anyOf:
                    - type: string
                      pattern: ^\s*(?:\S(?:[\s\S]{0,38}\S)?)?\s*$
                    - type: 'null'
                name:
                  anyOf:
                    - type: string
                      pattern: ^\s*(?:\S(?:[\s\S]{0,198}\S)?)?\s*$
                    - type: 'null'
                legalName:
                  anyOf:
                    - type: string
                      pattern: ^\s*(?:\S(?:[\s\S]{0,198}\S)?)?\s*$
                    - type: 'null'
              additionalProperties: false
            - type: 'null'
        customFields:
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties: {}
            - type: 'null'
        applyToClosed:
          type:
            - boolean
            - 'null'
        lines:
          anyOf:
            - maxItems: 500
              type: array
              items:
                type: object
                properties:
                  sku:
                    type: string
                    pattern: ^\s*(?:\S(?:[\s\S]{0,198}\S)?)\s*$
                  name:
                    anyOf:
                      - type: string
                        pattern: ^\s*(?:\S(?:[\s\S]{0,498}\S)?)?\s*$
                      - type: 'null'
                  quantity:
                    type:
                      - number
                      - string
                      - 'null'
                  unitPrice:
                    type:
                      - number
                      - string
                      - 'null'
                  lineTotal:
                    type:
                      - number
                      - string
                      - 'null'
                  externalLineId:
                    anyOf:
                      - type: string
                        pattern: ^\s*(?:\S(?:[\s\S]{0,198}\S)?)?\s*$
                      - type: 'null'
                required:
                  - sku
                additionalProperties: false
            - type: 'null'
        discount:
          type:
            - number
            - string
            - 'null'
      required:
        - pipelineId
      additionalProperties: false
    OpportunityWriteResult:
      type: object
      properties:
        id:
          anyOf:
            - type: string
              description: UUID
            - type: 'null'
          description: Null only on a dry run that would create the opportunity.
        result:
          type: string
          enum:
            - created
            - updated
            - unchanged
            - frozen
        stageId:
          type: string
          description: UUID
        stageChange:
          anyOf:
            - type: object
              properties:
                fromStageId:
                  anyOf:
                    - type: string
                      description: UUID
                    - type: 'null'
                toStageId:
                  type: string
                  description: UUID
              required:
                - fromStageId
                - toStageId
              additionalProperties: false
            - type: 'null'
          description: Set when an existing item moved stage.
        protectedFields:
          type: array
          items:
            type: string
            description: UUID
          description: Custom field ids not written because a person owns that value.
        dryRun:
          description: 'Present on a `?dryRun=true` answer: nothing was written.'
          type: boolean
          const: true
      required:
        - id
        - result
        - stageId
        - stageChange
        - protectedFields
      additionalProperties: false
    Error:
      type: object
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
          required:
            - code
            - message
          additionalProperties: false
      required:
        - ok
        - error
      additionalProperties: false
  headers:
    X-RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Seconds until the current window resets (at least 1). Not a Unix time.
      schema:
        type: integer
    Idempotent-Replayed:
      description: >-
        `true` when the answer is a stored replay of an earlier identical
        request.
      schema:
        type: string
    WWW-Authenticate:
      description: '`Bearer`.'
      schema:
        type: string
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  responses:
    Unauthenticated:
      description: Missing, malformed, unknown or revoked key.
      headers:
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            default:
              value:
                ok: false
                error:
                  code: UNAUTHENTICATED
                  message: Invalid or revoked API key
    Forbidden:
      description: >-
        `FORBIDDEN` when the key lacks the operation's permission
        (`details.requiredScope`); `PLAN_READ_ONLY` or `PLAN_LIMIT_REACHED` when
        the organization's plan refuses a write.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            default:
              value:
                ok: false
                error:
                  code: FORBIDDEN
                  message: This API key lacks the opportunities:write scope
                  details:
                    requiredScope: opportunities:write
    NotFound:
      description: Not found in the key's organization.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            default:
              value:
                ok: false
                error:
                  code: NOT_FOUND
                  message: Opportunity not found
    Conflict:
      description: '`CONFLICT` or `IDEMPOTENCY_KEY_IN_PROGRESS`.'
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PayloadTooLarge:
      description: The body is larger than 1048576 bytes.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: >-
        `VALIDATION_ERROR` with `details.fieldErrors` by field, or
        `IDEMPOTENCY_KEY_REUSED`.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            default:
              value:
                ok: false
                error:
                  code: VALIDATION_ERROR
                  message: The request is not valid
                  details:
                    fieldErrors:
                      limit:
                        - At most 100
    RateLimited:
      description: >-
        Too many requests for the key, its organization, or failed
        authentications from the client IP. Every 429 has `Retry-After`; the
        `X-RateLimit-*` headers come only when the key's or the organization's
        limit refused the request, not on the failed-authentication limit.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            default:
              value:
                ok: false
                error:
                  code: RATE_LIMITED
                  message: Too many requests for this API key or its organization
    InternalError:
      description: >-
        Unexpected failure. The write may or may not have happened, and the
        answer is not stored for `Idempotency-Key`: a retry runs the write
        again, so check the resource first.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'An organization API key: `elo_` followed by 43 characters.'

````

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