---
title: "Upsert leads."
method: POST
path: "/api/external/v1/leads/upsert-leads"
tags: ["Leads"]
---

# Upsert leads.

`POST /api/external/v1/leads/upsert-leads`

This endpoint is used to upsert (update or insert) leads.

The leads are sent in the request body.
The leads are an array of objects.
The leads.*.values are key/value pairs with the values of the lead.

---
### Required fields for creating or updating a lead

**To create a new lead, at least one of:**
- `email`
- `linkedin_profile_url`

**To update an existing lead, at least one of:**
- `lead_id` (GenPage Lead ID)
- `genpage_url` (GenPage URL)

---
### Optional but strongly recommended fields
- `first_name`
- `company_name`
- `company_domain`
---

The response is the job ID.

The job ID can be used to get the status of the job, and get all the leads that were upserted by this request.

## Request body

- object
  - `from` string, nullable, required — The service that is sending the leads, use your own company/service name please.
  - `campaign_id` integer, required — The campaign ID to add the leads to.
  - `audience_id` integer, nullable, required — The audience ID to add the leads to.
  - `callback_url` string, nullable — Must be a valid URL.
  - `is_generate_ai_analysis` boolean, nullable — Whether to generate AI analysis for the leads.
  - `leads` string[], required — Array of lead objects to upsert.

## Response `200`

- object
  - `job_id` string

## Other responses

- `401`

---

[API](https://skmtc.net/genpage/apis/genpage-external-api-documentation.md) · [All operations](https://skmtc.net/genpage/apis/genpage-external-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/genpage/genpage-external-api-documentation/versions/acb1ec583488/schema)
