Skip to main content
DELETE
/
companies
/
{companyId}
Delete Company
curl --request DELETE \
  --url https://api.lemlist.com/api/companies/{companyId} \
  --header 'Authorization: Basic <encoded-value>'
{ "success": true, "deletedCompanyId": "cpn_A1B2C3D4E5F6G7H8I" }

Documentation Index

Fetch the complete documentation index at: https://developer.lemlist.com/llms.txt

Use this file to discover all available pages before exploring further.

Removes a lemlist company. Only the lemlist record is deleted — no CRM-side propagation is performed. By default, the request fails with 400 COMPANY_HAS_CONTACTS if any contact is still attached to the company. Pass ?force=true to detach those contacts (their companyId is unset) before deletion.

Remapping duplicates: typical workflow

This endpoint is the final step of the contact-to-company remapping flow used to resolve UNIQUE_INDEX_ERROR_COMPANY sync failures:
  1. GET /companies?crmSyncStatus=unique_index_error_company — list lemlist companies that fail to sync because another lemlist company already occupies their CRM record. Each result exposes crmSync.errors[].metadata.alreadyExistingCompanyId — the canonical lemlist company already linked to the CRM record.
  2. GET /contacts?companyId={duplicateCompanyId} — list contacts attached to the duplicate.
  3. POST /contacts/{idOrEmail} with companyId: {canonicalCompanyId} — reassign each contact to the canonical lemlist company.
  4. DELETE /companies/{duplicateCompanyId} — drop the now-empty duplicate. If step 3 was completed for every contact, the call succeeds without force. Otherwise use ?force=true to detach the remaining contacts as part of the deletion.
There is no soft-delete or undo. Once deleted, the lemlist company record is gone. Contacts detached via force=true keep all their other data — only their companyId is unset.

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Path Parameters

companyId
string
required

The lemlist company ID to delete.

Pattern: ^cpn_[a-zA-Z0-9]+$

Query Parameters

force
boolean
default:false

When true, detaches contacts attached to this company (unsets their companyId) before deleting it. When omitted or false, the request fails with 400 COMPANY_HAS_CONTACTS if any contact is still attached.

Response

Company deleted.

success
boolean
required
deletedCompanyId
string
required

ID of the deleted lemlist company.

unlinkedContacts
integer

Number of contacts whose companyId was unset before deletion. Only present when force=true.