---
title: "Update Lead Schema"
method: PATCH
path: "/api/v1/campaigns/{campaign_id}/lead-schema"
tags: ["Campaigns"]
---

# Update Lead Schema

`PATCH /api/v1/campaigns/{campaign_id}/lead-schema`

## Request

- Base URL: `http://localhost:3009`
- URL: `http://localhost:3009/api/v1/campaigns/{campaign_id}/lead-schema`
- Auth: HTTP bearer

Registers the fields a lead can carry. Add Leads ignores any key that isn't in the schema, so call this first when pushing leads with custom fields.

**Additive** — a field you don't mention is kept, so a partial write never wipes the rest. A new `name` creates a field; re-sending an existing one is a no-op. A field's `type` is locked once created (a different type is ignored rather than rewriting stored values), and `email` and `name` are fixed fields that cannot be renamed, retyped or removed.

The schema is written to the draft, so fields registered here survive the next publish, and to the live sequence when one already exists. Registering fields never publishes a sequence on its own. Returns the full merged schema.

## Path parameters

- `campaign_id` string, required

## Request body

- object
  - `fields` object[], required: Fields to register. Existing fields not listed here are left untouched.
    - `name` string, required: Field name — the key to use for this field when adding leads
    - `type` string: Field type, applied on creation only. Defaults to `string`.

## Response `200`

Default Response

- object
  - `status` integer
  - `message` string
  - `data` object
    - `campaign_id` string
    - `fields` CampaignLeadField[]: The campaign's full lead schema after the merge
      - `name` string: Field name — the key to use in a lead object
      - `type` string: Declared field type
      - `required` boolean: Whether the field must be provided

## Other responses

- `400`: No fields given, or a name collides with an existing field
- `401`: Unauthorized — missing or invalid API key
- `403`: Forbidden. `code` says which permission refused: ROLE_FORBIDDEN (your role), INSUFFICIENT_SCOPE (the API key's scopes), WORKFLOW_FORBIDDEN (no access to the workflow), KEY_WORKFLOW_FORBIDDEN (the API key's workflow restriction).
- `404`: Campaign not found
- `429`: Too Many Requests — rate limit exceeded. Check `Retry-After` header for seconds until the limit resets.

---

[API](https://skmtc.dev/floqer/apis/floqer-public-api.md) - [All operations](https://skmtc.dev/floqer/apis/floqer-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/floqer/apis/floqer-public-api/revisions/fce50dc07b20?raw)
