# Public API

Connect your own systems to Lead: create an API key, then read and update leads, stages, notes and call logs with simple JSON requests.

Source: https://support.rework.com/article/lead-public-api

> **In plain words:** The **Public API** lets a program you or your developer wrote talk to Lead. It can read your leads and pipelines, change a lead's details, owner, stage or status, and add notes and call logs. It cannot create leads. To create leads you send them to a source webhook. Read this page if you build or maintain a connection between Lead and your own systems. New to Lead words such as lead, service or stage? See [Lead basics: words to know](https://support.rework.com/article/lead-basics).

**Where to find it:** keys are created in the **Settings** app (not inside Lead). The requests go to the Lead address shown below. **Who can use it:** Creating a key needs an administrator of your Rework workspace. Using it needs a developer.

## What the API is for

| 
You want to

 | 

Use

 |
| --- | --- |
| 

Create a lead from your website form or another tool

 | 

A source **webhook**, not this API. See [Website forms, webhooks and Zapier](https://support.rework.com/article/lead-webhooks)

 |
| 

Read leads, or copy them into another system

 | 

`lead/list` and `lead/get`

 |
| 

Keep a copy in sync

 | 

`lead/list` with an "updated since" filter

 |
| 

Update a lead from your own system

 | 

The `lead/edit` family

 |
| 

Put a call, meeting or note on a lead

 | 

The `feed/create` endpoints

 |
| 

Learn the stage, status, label and field names of a service

 | 

The `service` endpoints

 |

A typical flow: your system sends a new lead to the webhook. The webhook answers with a `lead_id`. Your system stores that id next to its own record. From then on it uses the id for every call below.

There is no search by email, phone or name, and no way to look a lead up by those. Keep the `lead_id` from the webhook answer instead.

## Create an API key

An **API key** is a secret that proves a request comes from your workspace. Only an administrator of the Rework Settings app can create one.

1. Open the **Settings** app from your Rework app menu.
   
2. In the left menu, under **System**, click **API keys**.
   
3. Click **New API key**. A dialog titled **Create an authorized token** opens.
   
4. Under **Application**, choose **Lead**. A key made for another app is refused by Lead.
   
5. Type a **Name**, for example "Zapier sync". Add a **Short description** if you want to note who owns the key.
   
6. Optional: tick **Enable password** and type a **Password**. When a key has a password, every request must send it too.
   
7. Optional: tick **This is an expirable token** and pick **Expired at**.
   
8. Optional: tick **Restrict accesses by IP ranges** and add the addresses allowed to call, in **Accepted IP ranges**. Press Enter after each one.
   
9. Optional: set **Daily quota** and **Monthly quota** (calls per day and per month).
   
10. Leave **Scopes** empty and keep **Token status** on **Enabled**.
    
11. Click **Generate token**. The key appears in the list.
    
12. Click the key's row. Under **Credentials**, copy the **API key** value. If you set a password, copy the **Password** too.
    

![Settings app, API keys page with the New API key button](https://storage.googleapis.com/reworkv3-public/success/261015/YvxY0syZ7G0ZydVhbBo5qSHDiizgNexVGU5mwHWQjVAXg6YFrP5xOMxKnNMdgCr2/img.kI8ELS7LEkVIN5KF6wdfmmOEURwLqKOttQwAoecxSWeb1ekARYmrdSHlffXnjou3.png)

> **Important:** The key gives access to all Lead data in your workspace, including permanently deleting leads. Treat it like a password. Store it in a secret manager, never in a web page, a mobile app or a public code repository.

To stop a key working, open its row and click **Revoke**. A revoked key can no longer sign in. **Delete** removes it from the list.

## Make your first call

Every request is a `POST` with a JSON body.

**Base address:**

```
https://api-v3.{domain}/lead/v1/{endpoint}
```

Replace `{domain}` with your Rework domain. The `ping` call, for example, is `https://api-v3.{domain}/lead/v1/ping`.

**Headers:**

| 
Header

 | 

Value

 | 

When

 |
| --- | --- | --- |
| 

`X-API-TOKEN`

 | 

Your API key

 | 

Always

 |
| 

`X-API-PASSWORD`

 | 

The key's password

 | 

Only if the key has a password

 |
| 

`Content-Type`

 | 

`application/json`

 | 

Always

 |

You can send the key and password as `access_token` and `password` in the body instead. Only these two ways work.

Test your key with `ping`:

```
curl -X POST "https://api-v3.{domain}/lead/v1/ping" \
  -H "X-API-TOKEN: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

You should get:

```
{ "status": 1, "message": "PONG" }
```

`sysinfo` answers with your workspace's id and name, which confirms the key belongs to the workspace you expect.

> **Note:** Send JSON only. A form-encoded body is read as empty, and the call fails as if its parameters were missing. If a correct-looking request fails, check `Content-Type` first.

## Every response has a status

```
{ "status": 1, "lead": { } }
{ "status": 0, "error": "not_found" }
```

`status` 1 means success. `status` 0 means failure, with a short `error` code. A lead also has its own `status` field (such as `open`). It lives inside the `lead` object and has nothing to do with the response `status`.

## The acting user

The key identifies your workspace, not a person. A call that changes a lead must say which user is acting. Add one of these to the body:

| 
Key

 | 

Notes

 |
| --- | --- |
| 

`user_id`

 | 

A user's id. The one to use

 |
| 

`username`

 | 

A user name

 |
| 

`creator_id`, `creator_username`

 | 

Also accepted

 |

The first one present is used. A number is read as an id, any other value as a user name.

- **Reads ignore it.** Any valid key can read.
  
- **Changes need it.** Lead checks that the acting user is allowed to do that change in the app. Without a valid acting user, every change answers `forbidden`.
  
- **Notes and call logs** are the exception: they do not check permission. `user_id` only sets who the entry is written by.
  

A user who can manage a lead is the workspace owner, a Lead admin, a manager of the lead's service, or the lead's owner, salesperson or creator.

## Read your setup

These calls need no acting user. Most take the service id in `id`.

| 
Endpoint

 | 

What it returns

 |
| --- | --- |
| 

`service/all`

 | 

Your lead services (set `metatype` to `events` for event gateways). Accepts `limit` and `page`

 |
| 

`service/get`

 | 

One service

 |
| 

`service/get.fields`

 | 

The custom fields of a service: `id`, `code`, `label`, `type` and options

 |
| 

`service/get.stages`

 | 

The stages: `id`, `name`, `color` and the stage group

 |
| 

`service/get.statuses`

 | 

The statuses: `key`, `label`, `color`

 |
| 

`service/get.labels`

 | 

The labels: `id`, `name`, `color`

 |
| 

`service/get.segments`

 | 

The segments and their options

 |
| 

`service/get.sources`

 | 

The sources that feed the service. The webhook address is never included

 |

Example:

```
curl -X POST "https://api-v3.{domain}/lead/v1/service/get.stages" \
  -H "X-API-TOKEN: YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{ "id": "SERVICE_ID" }'
```

```
{ "status": 1, "stages": [ { "id": "aEy4SHue-vBxUShpjXB-Lxhvu8puAL0", "name": "Connected", "lc_status": 1 } ] }
```

Use a stage's `id` when you move a lead. Do not use `lc_status`, which is only the stage group (`-1` not started, `1` in progress, `10` qualified, `-10` disqualified).

A service that has not set its own statuses accepts the five built-in keys: `prospect`, `open`, `nurture`, `inactive`, `not_a_target`.

## Read leads

### List leads

`lead/list` needs `service_id`. Everything else is optional.

| 
Parameter

 | 

What it does

 |
| --- | --- |
| 

`service_id`

 | 

**Required.** The service to list from

 |
| 

`source_id`, `campaign_id`

 | 

Only leads from this source or campaign

 |
| 

`status`, `stage_id`, `label`

 | 

A value, or a list of values

 |
| 

`owner_id`, `salesman_id`

 | 

Only leads of this person

 |
| 

`score_min`, `score_max`

 | 

A score range

 |
| 

`has_email`, `has_phone`

 | 

`1` for only leads that have one

 |
| 

`is_mql`, `blacklisted`

 | 

`1` for only these leads, `0` for only the others, leave out for both

 |
| 

`created_from`, `created_to`

 | 

A time range, in Unix seconds. Either end may stand alone

 |
| 

`updated_from`, `updated_to`

 | 

The same, for the last change

 |
| 

`stage_updated_from`, `stage_updated_to`

 | 

The same, for the last stage change

 |
| 

`status_updated_from`, `status_updated_to`

 | 

The same, for the last status change

 |
| 

`sort_by`

 | 

`created` (default), `updated`, `stage_updated`, `status_updated`, `score`, `name`

 |
| 

`sort_order`

 | 

`desc` (default) or `asc`

 |
| 

`limit`

 | 

Rows per page, 1 to 200. Default 50

 |
| 

`page`

 | 

Page number, starting at 0

 |

Example: the 200 oldest-changed leads since a given time.

```
{
  "service_id": "SERVICE_ID",
  "updated_from": 1785000000,
  "sort_by": "updated",
  "sort_order": "asc",
  "limit": 200
}
```

```
{ "status": 1, "leads": [ ], "total": 452, "page": 0, "per_page": 50, "has_more": true }
```

To **keep a copy in sync**, call this with `updated_from` set to the time of your last good sync, sorted by `updated` ascending, and read page after page while `has_more` is true.

A wrong value is refused with `invalid_data` rather than ignored, so a broken filter never hands you the whole list by mistake.

### Get one lead

```
{ "id": "LEAD_ID" }
```

to `lead/get` returns `{ "status": 1, "lead": { } }`. The lead includes its stage, score, company and **every** custom field in `form`:

```
"form": [ { "id": "int_1", "code": "industry", "name": "Industry", "value": "Tech", "display": "Tech", "type": "select" } ]
```

Match fields by `id` or `code`. Use `service/get.fields` to learn what they mean. Dates in `display` are written in UTC, so read `value` (Unix seconds) when you need the exact moment.

## Change a lead

All of these need `user_id` and the lead's `id`.

| 
Endpoint

 | 

What it changes

 | 

Key parameters

 |
| --- | --- | --- |
| 

`lead/edit`

 | 

Details and custom fields in one call

 | 

`name`, `prefix`, `title`, `company`, `email`, `phone`, `content`, `followers`, `collaborators`, `labels`, `campaign_ids`, `segments`, `form`

 |
| 

`lead/edit.cfield`

 | 

One custom field

 | 

`code`, `value`

 |
| 

`lead/edit.owner`

 | 

The owner

 | 

`owner_id` (`0` removes the owner)

 |
| 

`lead/edit.status`

 | 

The status

 | 

`status` (a status key)

 |
| 

`lead/edit.stage`

 | 

The stage

 | 

`stage_id`, and optionally `status` and `form`

 |
| 

`lead/edit.blacklist`

 | 

Blocks or unblocks the lead

 | 

`blacklisted` (`1` or `0`), optional `reason`

 |
| 

`lead/remove`

 | 

Deletes the lead

 | 

none

 |

### Edit details

Send only what you want to change.

```
{
  "user_id": 1,
  "id": "LEAD_ID",
  "company": "Acme JSC",
  "phone": "VN:0909123456",
  "labels": ["LABEL_ID"],
  "form": { "industry": "Tech", "budget": 5000 }
}
```

```
{ "status": 1, "action": "edited", "lead": { } }
```

Things to know:

- **Phone numbers** are written as `COUNTRY:number`, such as `VN:0909123456`. A local number is read in your workspace's country.
  
- **Labels** are label ids, taken from `service/get.labels`. A name is not accepted. The list you send replaces the old one. The same is true of `followers`, `collaborators` and `campaign_ids`.
  
- **Custom fields** can be sent three ways: `{ "industry": "Tech" }`, `[{ "code": "industry", "value": "Tech" }]` or `[{ "id": "int_7", "value": "Tech" }]`. Only the fields you send change.
  
- **File fields** take a public web address. Lead downloads the file when you call and keeps its own copy.
  
- **Dates without a time zone** in a custom field are read in your workspace time zone. Add an offset such as `+07:00` to be exact.
  
- **Owner, stage and status are refused here.** Use their own endpoints. Sending `owner_id`, `stage` or `status` to `lead/edit` answers `invalid_data` and names the endpoint to use. The salesman cannot be set by the API: it is set when a lead is converted to Sales.
  
- **A field name Lead does not know is reported**, not skipped. You get `invalid_data` with the name in `errors`, so a typo never looks like a success.
  
- **Repeating a call is safe.** Only values that differ are saved, so a retry changes nothing and starts no automation.
  
- **An edit through the API is the same as an edit on screen.** It appears in the lead's history, notifies followers, re-scores the lead and re-checks routing.
  

### Move a lead to a stage

```
{ "user_id": 1, "id": "LEAD_ID", "stage_id": "STAGE_ID", "status": "open", "form": { "budget": 5000 } }
```

```
{ "status": 1, "action": "moved", "lead": { } }
```

A stage can require custom fields. If one is empty, the move is refused and nothing is saved:

```
{ "status": 0, "error": "invalid_data",
  "errors": { "budget": "Budget is required" },
  "missing": [ { "id": "int_7", "code": "budget", "name": "Budget", "level": "required" } ] }
```

Send the missing values in `form` and the same call goes through. The same rule applies when someone moves a lead on screen. Moving into a Qualified stage marks the lead as an MQL. See [Moving a lead through stages](https://support.rework.com/article/lead-moving-stages).

### Change the owner

```
{ "user_id": 1, "id": "LEAD_ID", "owner_id": 289 }
```

An unknown or deactivated user answers `invalid_data` with `errors.owner_id`.

### Block or unblock

`lead/edit.blacklist` sets a state rather than flipping it, so a retry is safe. The `action` in the answer is `blacklisted`, `unblacklisted`, or `unchanged` when nothing needed to change. See [Blocklist rules](https://support.rework.com/article/lead-blocklist).

### Delete a lead

```
{ "user_id": 1, "id": "LEAD_ID" }
```

The answer contains the lead as it was just before deletion, so you can update your own records.

> **Important:** `lead/remove` deletes the lead permanently. There is no undo. The acting user needs the same delete right as in the app. If the service limits deleting to some people, only they can do it through the API too. See [Access and visibility](https://support.rework.com/article/lead-access-and-visibility).

## Notes, quick logs, meetings and calls

The feed is the list of everything that happened on a lead. See [Notes, emails, calls, meetings and chats](https://support.rework.com/article/lead-activities).

### Read the feed

`lead/feed/list` takes `lead_id` and returns entries newest first.

| 
Parameter

 | 

What it does

 |
| --- | --- |
| 

`lead_id`

 | 

**Required.** The lead

 |
| 

`kind`

 | 

`note`, `call`, `meeting`, `mail`, `chat` or `changelog`

 |
| 

`creator_id`

 | 

Only entries written by this user

 |
| 

`created_from`, `created_to`, `updated_from`, `updated_to`

 | 

Time ranges in Unix seconds

 |
| 

`limit`

 | 

1 to 100. Default 30

 |
| 

`before_ts`, `before_id`

 | 

Send the values from `next_cursor` to get the next page

 |
| 

`user_id`

 | 

Needed to see `mail` entries. Other kinds do not need it

 |

The answer holds `feeds`, `has_more` and `next_cursor`.

### Add an entry

| 
Endpoint

 | 

Adds

 | 

Own parameters

 |
| --- | --- | --- |
| 

`lead/feed/create/note`

 | 

A note

 | 

`color` (`none`, `yellow`, `blue`, `green`, `violet`, `red`, `orange`)

 |
| 

`lead/feed/create/quicklog`

 | 

Work already done, such as a visit

 | 

`stime`, `etime`, `duration_min`

 |
| 

`lead/feed/create/meetinglog`

 | 

A meeting

 | 

`stime`, `etime`, `duration_min`, `location`, `status`, `members`

 |
| 

`lead/feed/create/calllog`

 | 

A phone call

 | 

`stime`, `direction`, `outcome`, `duration_min`, `members`

 |

Every one of them takes these shared parameters:

| 
Parameter

 | 

What it is

 |
| --- | --- |
| 

`source_type`

 | 

Always `lead`

 |
| 

`source_id`

 | 

The lead's id

 |
| 

`user_id`

 | 

The author. Without one, the entry shows "External API" as its author

 |
| 

`name`

 | 

A title, up to 255 characters

 |
| 

`content`

 | 

The text. A note and a quick log accept basic HTML. Meeting and call logs keep plain text

 |

Give at least a `name` or a `content`.

Example: log a call.

```
{
  "source_type": "lead",
  "source_id": "LEAD_ID",
  "user_id": 1,
  "name": "Pricing call",
  "content": "Discussed pricing.",
  "stime": "2026-09-16T09:30:00+07:00",
  "direction": "outbound",
  "outcome": "Connected",
  "duration_min": 12
}
```

```
{ "status": 1, "action": "created", "feed": { } }
```

- **Times** (`stime`, `etime`) are Unix seconds or ISO 8601 with an offset, such as `2026-09-16T09:30:00+07:00`. Other forms are refused.
  
- A quick log or call cannot be in the future. A meeting can, which books it. `status` for a meeting is `completed`, `scheduled` or `cancelled`.
  
- `direction` is `inbound` or `outbound`. `outcome` is free text. The app offers Connected, No answer, Voicemail and Wrong number.
  
- `members` is a list of names, or one comma-separated text, up to 50.
  
- **These calls are not safe to repeat.** Each call adds a new entry. If you never got an answer, check the lead's feed before you send it again.
  

## Limits

| 
Limit

 | 

Value

 |
| --- | --- |
| 

Per key

 | 

200 requests every 10 minutes

 |
| 

Per workspace, across all keys

 | 

1,000 requests every hour

 |

A request over the limit answers `429` with `rate_limited` and a `Retry-After` header that says when to try again. The response also carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Slow down, wait, and retry. These limits apply to every key, whatever quotas you set on the key itself.

## Errors

| 
Code

 | 

Comes as

 | 

What it means

 | 

What to do

 |
| --- | --- | --- | --- |
| 

`unauthorized`

 | 

HTTP 401

 | 

The key is missing, wrong, revoked, expired, sent from a blocked address, or its password is wrong

 | 

Check the header, the password and the key's status and IP list in the Settings app

 |
| 

`rate_limited`

 | 

HTTP 429

 | 

Too many requests

 | 

Wait for `Retry-After`, then retry

 |
| 

`not_found`

 | 

HTTP 404 or in the reply

 | 

The address, or the record in your workspace, does not exist

 | 

Check the id. A record from another workspace also answers this

 |
| 

`forbidden`

 | 

In the reply

 | 

The acting user is not allowed, or none was given

 | 

Add `user_id`, or use a user with the right

 |
| 

`invalid_data`

 | 

In the reply

 | 

A value is wrong. `errors` names each field

 | 

Fix the fields listed in `errors`

 |
| 

`invalid_service`

 | 

In the reply

 | 

The service id is missing or not yours

 | 

Use an id from `service/all`

 |
| 

`invalid_stage`

 | 

In the reply

 | 

The stage is not in this service

 | 

Use a stage `id` from `service/get.stages`, not `lc_status`

 |
| 

`invalid_status`

 | 

In the reply

 | 

The service does not use this status

 | 

Use a key from `service/get.statuses`

 |
| 

`invalid_field`

 | 

In the reply

 | 

The custom-field code does not exist

 | 

Use a code from `service/get.fields`

 |
| 

`invalid_feed_kind`

 | 

In the reply

 | 

The feed kind is unknown

 | 

Use one of the kinds in the feed table

 |
| 

`invalid_source`

 | 

In the reply

 | 

`source_type` is not `lead`, or the lead is not in your workspace

 | 

Check `source_id`

 |

Errors marked "In the reply" arrive with a normal reply and `status` 0. Always read `status`, not only the HTTP code.

## Keep your key safe

- **Keep it secret.** Do not put it in browser code, mobile apps, screenshots or shared chats.
  
- **Limit where it works.** Turn on **Restrict accesses by IP ranges** and list only your server's addresses.
  
- **Add a password** for extra safety, and give the key an expiry date.
  
- **Use one key per connection.** Name each clearly. Then you can revoke one without breaking the others.
  
- **Rotate keys.** Create a new key, switch your system to it, then **Revoke** the old one. Do this straight away if a key may have leaked or someone who knew it has left.
  
- **Remember who can act as whom.** Anyone with the key can name any user in the workspace as the acting user. Guard the key as you would an administrator's password.
  

## Troubleshooting

| 
Problem

 | 

Why it happens

 | 

What to do

 |
| --- | --- | --- |
| 

Every call answers `unauthorized`

 | 

The key was made for another app, the password is missing, or your address is not on the allowed list

 | 

Make the key with **Application** set to **Lead**. Send `X-API-PASSWORD` if the key has a password

 |
| 

A call that looks right says a parameter is missing

 | 

The body was not sent as JSON

 | 

Send `Content-Type: application/json` and a JSON body

 |
| 

Edits answer `forbidden`

 | 

No acting user, or the user cannot manage that lead

 | 

Add `user_id` of someone who can

 |
| 

`lead/edit` refuses `stage`, `status` or `owner_id`

 | 

These have their own endpoints

 | 

Use `edit.stage`, `edit.status` or `edit.owner`

 |
| 

A stage change answers `invalid_data` with `missing`

 | 

The stage needs custom fields that are empty

 | 

Send the fields in `form` on the same call

 |
| 

I need to find a lead by email

 | 

The API does not search by email or phone

 | 

Keep the `lead_id` from the webhook answer

 |
