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

# Update Lead by ID

> Update one lead by its Octanist ID with PATCH /api/leads/{id}: status, value, note, lost reason, contact details in set and the won conversion, without identifier matching.

Update one lead that you name by its Octanist ID in the URL. The body takes the same changes as [`PATCH /api/leads`](https://octanist.com/docs/api-reference/endpoint/update-lead), without the identifiers.

Use this endpoint when you stored the Octanist lead ID, for example from the response of `POST /api/leads`. Use `PATCH /api/leads` when you only know the email, phone or your own external ID.

Differences with `PATCH /api/leads`:

* The URL names the lead. Sending `id`, `externalId`, `email` or `phone` in the body returns `400 VALIDATION_ERROR`. To change contact details or the external ID, send them in `set`.
* An unknown ID returns `404 NOT_FOUND`. It is not kept as a pending update and not logged as a missed update.
* There is no matching, so the Multiple Match Behavior and Same-Company Lead Matching settings do not apply.

Locked leads, which are over your plan's lead limit, can be updated too. They still send conversions.

## Path Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | string | Yes | Octanist lead ID |

## Request Body

| Field | Type | Required | Description |
| - | - | - | - |
| `status` | string | No | New status: `open`, `qualified`, `won`, or `lost`. `open` reopens a lead. |
| `changedTo` | string | No | Legacy alias for `status`: `qualified`, `won`, or `lost` |
| `value` | number \| string | No | Lead value. Strings such as `"1.234,56"` or `"1,234.56"` are converted to numbers. Negative values return `400`. |
| `note` | string | No | Note to attach to the lead |
| `lossReason` | string | No | Reason for loss (only used when `status` is `lost`) |
| `set` | object | No | New values for `externalId`, `name`, `email`, `phone`, `custom` and `labelId`. `null` clears a field. See [Changing lead fields with set](https://octanist.com/docs/api-reference/endpoint/update-lead.md#changing-lead-fields-with-set). |
| `conversionEventId` | string | No | Won conversion to send when the lead is won, now or later. See [Choosing the won conversion](https://octanist.com/docs/api-reference/endpoint/update-lead.md#choosing-the-won-conversion). |

The [status rules](https://octanist.com/docs/api-reference/endpoint/update-lead.md#status-rules) are the same as for `PATCH /api/leads`.

## Example Request

```bash theme={null}
curl -X PATCH \
  -H "X-API-KEY: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "won",
    "value": "1.250,50",
    "set": {
      "externalId": "CRM-88412",
      "labelId": "label_xyz"
    }
  }' \
  "https://octanist.com/api/leads/lead_abc123"
```

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "matched": true,
    "leadId": "lead_abc123",
    "externalId": "CRM-88412",
    "leadsUpdated": 1,
    "leads": [
      {
        "id": "lead_abc123",
        "externalId": "CRM-88412",
        "status": "won",
        "value": 1250.5,
        "labelId": "label_xyz",
        "conversionEventId": null,
        "locked": false
      }
    ],
    "message": "Lead updated successfully"
  },
  "meta": {
    "requestId": "req_a1b2c3d4e5f6",
    "timestamp": "2026-03-10T12:00:00.000Z"
  }
}
```

The response fields and `warnings` are the same as for [`PATCH /api/leads`](https://octanist.com/docs/api-reference/endpoint/update-lead#response-fields).

## Error Responses

| Status | Code | Description |
| - | - | - |
| 400 | `VALIDATION_ERROR` | Invalid JSON, identifiers in the body, invalid value or status, unknown keys in `set`, an unknown `labelId` or `conversionEventId`, or a won update without a value above 0 |
| 401 | `UNAUTHORIZED` | Missing or invalid API key |
| 403 | `FORBIDDEN` | A [read-only API key](https://octanist.com/docs/api-reference/authentication.md#key-access), or the organization is a read-only demo |
| 404 | `NOT_FOUND` | No lead with this ID in your organization |
| 409 | `CONFLICT` | `set.externalId` belongs to another lead, or the lead was changed by another update at the same time (retry the request) |
| 500 | `INTERNAL_ERROR` | Unexpected server error. Retry the request, or contact support with the `requestId`. |


## OpenAPI

````yaml PATCH /api/leads/{id}
openapi: 3.0.1
info:
  title: Octanist API
  description: >-
    The Octanist API allows you to create, update and read leads, run reports,
    read workspace settings, retrieve statistics, and access ad spend data.
  version: 2.5.0
  contact:
    name: Octanist Support
    url: https://octanist.com/docs
servers:
  - url: https://octanist.com
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /api/leads/{id}:
    patch:
      tags:
        - Leads
      summary: Update Lead by ID
      description: >-
        Update one lead named by its Octanist ID. Takes the changes of PATCH
        /api/leads without identifiers. An unknown ID returns 404. Locked leads
        can be updated.
      parameters:
        - name: id
          in: path
          required: true
          description: Octanist lead ID
          schema:
            type: string
            example: lead_abc123
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateLeadByIdRequest'
      responses:
        '200':
          description: Lead updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/UpdateLeadResult'
                  meta:
                    $ref: '#/components/schemas/Meta'
        '400':
          description: >-
            Invalid JSON, identifiers in the body, invalid value or status,
            unknown keys in set, an unknown labelId or conversionEventId, or a
            won update without a value above 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: A read-only API key, or the organization is a read-only demo
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Lead not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            set.externalId belongs to another lead, or the lead changed during
            the update
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Unexpected server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    UpdateLeadByIdRequest:
      type: object
      description: >-
        The changes of PATCH /api/leads without identifiers: the URL names the
        lead. Sending id, externalId, email or phone returns 400.
      properties:
        status:
          type: string
          enum:
            - open
            - qualified
            - won
            - lost
          description: >-
            New status. `open` reopens a qualified, won or lost lead;
            conversions already sent are not retracted. Takes precedence over
            `changedTo` if both are provided.
          example: won
        changedTo:
          type: string
          enum:
            - qualified
            - won
            - lost
          description: Legacy alias for `status`. Does not accept `open`.
          example: won
        value:
          oneOf:
            - type: number
              minimum: 0
            - type: string
          description: >-
            Lead value. Strings such as "1.234,56" or "1,234.56" are converted
            to numbers. A string that is not a number, or a negative value,
            returns 400.
          example: 5000
        note:
          type: string
          description: Note to attach to the lead
        lossReason:
          type: string
          description: >-
            Reason for loss (only used when status is `lost`). Free text; when
            the workspace has a fixed list (GET /api/workspace, `lostReasons`),
            send one of those reasons.
        set:
          $ref: '#/components/schemas/LeadSetFields'
        conversionEventId:
          type: string
          description: >-
            ID of a won conversion from GET /api/workspace. Chooses which won
            conversion is sent when this lead is won, in this update or later.
            Other IDs return 400.
          example: conv_won_subscription
    UpdateLeadResult:
      type: object
      properties:
        matched:
          type: boolean
          description: '`true` when a lead matched, `false` when none did'
          example: true
        leadId:
          type: string
          nullable: true
          description: First updated lead
          example: lead_abc123
        externalId:
          type: string
          nullable: true
          description: >-
            External ID of the first updated lead. Left out when no lead
            matched.
          example: QUOTE-2026-0042
        leadsUpdated:
          type: integer
          example: 1
        leads:
          type: array
          items:
            $ref: '#/components/schemas/LeadUpdateSummary'
        warnings:
          type: array
          items:
            type: string
          description: >-
            Only present when a requested status was not applied, one message
            per lead. The other changes were applied.
          example:
            - >-
              Status not changed on lead lead_abc123: it is already won. Send
              "status": "open" first to reopen it.
        message:
          type: string
          example: Lead updated successfully
    Meta:
      type: object
      properties:
        requestId:
          type: string
          example: req_a1b2c3d4e5f6
        timestamp:
          type: string
          format: date-time
          example: '2026-03-10T12:00:00.000Z'
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
              example: VALIDATION_ERROR
            message:
              type: string
              description: Human readable error message
              example: Human readable error message
            details:
              type: object
              description: Optional additional error details
        meta:
          $ref: '#/components/schemas/Meta'
    LeadSetFields:
      type: object
      additionalProperties: false
      description: >-
        New values to store on the matched lead. Identifiers only find the lead;
        these fields change it. `null` clears a field. Fields left out are not
        changed. Other keys return 400. `set` never changes more than one lead.
      properties:
        externalId:
          type: string
          nullable: true
          minLength: 1
          maxLength: 255
          description: >-
            Customer-owned ID to store on the lead. Returns 409 when another
            lead already has it.
          example: CRM-88412
        name:
          type: string
          nullable: true
          description: New name
          example: John Doe
        email:
          type: string
          nullable: true
          description: New email address
          example: new@example.com
        phone:
          type: string
          nullable: true
          description: New phone number
          example: '+31612345678'
        custom:
          oneOf:
            - type: string
            - type: object
            - type: array
          nullable: true
          description: >-
            An object is merged into the stored custom data key by key; a key
            set to null is removed. A string or array replaces the stored data,
            as does an object when the stored data is not a JSON object.
          example:
            company: Acme Inc
            fax: null
        labelId:
          type: string
          nullable: true
          description: >-
            Label ID from GET /api/workspace, or null to remove the label. An
            unknown ID returns 400.
          example: label_xyz
    LeadUpdateSummary:
      type: object
      description: A lead after the update
      properties:
        id:
          type: string
          example: lead_abc123
        externalId:
          type: string
          nullable: true
          example: QUOTE-2026-0042
        status:
          type: string
          enum:
            - open
            - qualified
            - won
            - lost
          description: >-
            Status after the update. Unlike GET /api/leads, a qualified lead
            shows `qualified`.
          example: won
        value:
          type: number
          nullable: true
          example: 5000
        labelId:
          type: string
          nullable: true
          example: null
        conversionEventId:
          type: string
          nullable: true
          description: Won conversion chosen for this lead, or null for the default
          example: null
        locked:
          type: boolean
          description: '`true` when the lead is over the plan''s lead limit'
          example: false
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key for authentication

````

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