logo

API v2 Documentation

Identification

Identification

Actions (POST)

Contacts
Create a contactEdit a contactDelete a contactFind a contactGet conversion statusesGet teamGet custom fields
Structures
Create a structureEdit a structureDelete a structureGet structures
Sales
Create a saleUpdate a saleDelete a saleGet sales columns
Actions
Create an actionUpdate an actionDelete an actionGet action columns
Lists
Get lists

Webhooks (GET)

Email
Added to listRemoved from list
Contacts
New contactsEdited contactsDeleted contacts
Structures
New structuresEdited structuresDeleted structures

API v2 Documentation - NextLead CRM

Complete documentation for the v2 automation API to integrate functionalities with external services.

Identification

This route allows you to verify the validity of your API key and identify your organization.

GET/api/v2/identify-user

Success Response:

{
  "status": 200,
  "data": {
    "name": "Your organization name"
  }
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Actions (POST)

Contacts

Create a contact

This route allows you to create a new contact in your organization. Supports socials, nextlead_config, and custom_fields arrays.

POST/api/v2/receive/contact/new-contact

Request Body:

{
  "firstName": "First name",
  "lastName": "Last name",
  "email": "email@example.com",
  "phone": "0123456789",
  "establishmentId": "establishment_id (optional)",
  "listId": "list_id (optional)",
  "socials": [
    {
      "linkedin": "https://linkedin.com/in/profile",
      "facebook": "https://facebook.com/profile",
      "instagram": "@profile"
    }
  ],
  "nextlead_config": [
    {
      "lead_score": 85,
      "conversion_status": "qualified",
      "assigned_to": "user_id",
      "add_to_list": "list_id"
    }
  ],
  "custom_fields": [
    {
      "selected_field1": "custom_field_type_id_1",
      "value_1": "Value for field 1",
      "selected_field2": "custom_field_type_id_2",
      "value_2": "Value for field 2",
      "selected_field3": "custom_field_type_id_3",
      "value_3": "Value for field 3"
    }
  ]
}

Success Response:

{
  "status": 201,
  "data": {
    "message": "Contact successfully added",
    "contact": {
      "id": "contact_id",
      "firstName": "First name",
      "lastName": "Last name",
      "email": "email@example.com",
      "phone": "0123456789",
      "organizationId": "org_id",
      "createdAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors:

400Invalid or missing data
401Missing or invalid automation API key
404Organization/List/Establishment not found
409A contact with this email already exists
500Error creating contact

Edit a contact

This route allows you to edit an existing contact. Search by email (mail) or LinkedIn (linkedin_find). Supports custom fields in values_update.

POST/api/v2/receive/contact/edit-contact

Request Body:

{
  "mail": "email@example.com (to find the contact)",
  "linkedin_find": "https://linkedin.com/in/profile (alternative to mail)",
  "values_update": [
    {
      "firstName": "New first name",
      "lastName": "New last name",
      "phone": "0123456789",
      "add_to_list": "list_id",
      "assigned_to": "user_id",
      "conversion_status": "qualified",
      "lead_score": 90,
      "selected_field1": "custom_field_type_id_1",
      "value_1": "Updated value for field 1",
      "selected_field2": "custom_field_type_id_2",
      "value_2": "Updated value for field 2",
      "selected_field3": "custom_field_type_id_3",
      "value_3": "Updated value for field 3"
    }
  ]
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Contact successfully updated",
    "contact": {
      "id": "contact_id",
      "firstName": "New first name",
      "lastName": "New last name",
      "updatedAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors:

400Contact email or LinkedIn URL required
401Missing or invalid automation API key
404Contact not found with provided criteria
500Internal server error

Delete a contact

This route allows you to delete an existing contact. Search by email or LinkedIn.

POST/api/v2/receive/contact/delete-contact

Request Body:

{
  "email": "email@example.com (priority)",
  "linkedin": "https://linkedin.com/in/profile (if no email)"
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Contact successfully deleted",
    "contact": {
      "id": "deleted_contact_id",
      "email": "email@example.com"
    },
    "success": true
  }
}

Possible Errors:

400Missing or invalid contact email address or LinkedIn account
401Missing or invalid automation API key
404No contact found with this email/LinkedIn
500Internal server error

Find a contact

This route allows you to search for an existing contact by email or LinkedIn.

POST/api/v2/receive/contact/find-contact

Request Body:

{
  "email": "email@example.com (optional)",
  "linkedin_url": "https://linkedin.com/in/profile (optional)"
}

Success Response:

{
  "status": 200,
  "data": [
    {
      "found": true,
      "id": "contact_id",
      "type": "LEAD",
      "civility": "Mr.",
      "first_name": "John",
      "last_name": "Doe",
      "birth_date": "1990-01-01T00:00:00.000Z",
      "sector": "Technology",
      "activity": "Developer",
      "status": "ACTIVE",
      "lead_score": 85,
      "phone": "0123456789",
      "mobile": "0987654321",
      "phone_pro": "0112233445",
      "email": "john.doe@example.com",
      "email2": "john.doe.pro@example.com",
      "email_verified": true,
      "comment": "Qualified contact",
      "linkedin": "https://linkedin.com/in/johndoe",
      "facebook": "https://facebook.com/johndoe",
      "instagram": "@johndoe",
      "twitter": "@johndoe",
      "otherSocials": "Other networks",
      "firstTouch": "2024-01-01T10:00:00.000Z",
      "lastTouch": "2024-01-15T14:30:00.000Z"
    }
  ]
}

Possible Errors:

400Missing contact email or LinkedIn URL
401Missing or invalid automation API key
404Organization not found
500Internal server error

Get conversion statuses

This route allows you to retrieve all available conversion statuses (CONVERSION_STATUS tags).

GET/api/v2/receive/contact/get-conversion

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "tag_id",
      "name": "Qualified",
      "color": "#28a745",
      "type": "CONVERSION_STATUS",
      "organizationId": "org_id"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Get team

This route allows you to retrieve all team members of the organization.

GET/api/v2/receive/contact/get-team

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "user_id",
      "name": "John Doe",
      "email": "john@example.com",
      "organizationId": "org_id"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Get custom fields

This route allows you to retrieve all custom fields available in your organization. Use the returned IDs in selected_field1, selected_field2, etc.

GET/api/v2/receive/contact/get-custom-fields

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "custom_field_type_id_1",
      "name": "Company Size",
      "type": "string",
      "groupId": "custom_field_set_id",
      "groupName": "Company Information"
    },
    {
      "id": "custom_field_type_id_2",
      "name": "Budget",
      "type": "number",
      "groupId": "custom_field_set_id",
      "groupName": "Company Information"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Structures

Create a structure

This route allows you to create a new establishment structure in your organization.

POST/api/v2/receive/structure/new-structure

Request Body:

{
  "name": "Structure name",
  "siret": "12345678901234 (optional)",
  "address1": "123 example street",
  "city": "City",
  "zipCode": "75000",
  "website": "https://www.example.com",
  "phone": "0123456789",
  "email": "contact@example.com",
  "comment": "Structure comment"
}

Success Response:

{
  "status": 201,
  "data": {
    "message": "Structure successfully created",
    "data": {
      "id": "structure_id",
      "type": "ESTABLISHMENT",
      "organizationId": "org_id",
      "establishment": {
        "id": "establishment_id",
        "name": "Structure name",
        "siret": "12345678901234",
        "organizationId": "org_id"
      },
      "address1": "123 example street",
      "city": "City",
      "zipCode": "75000",
      "website": "https://www.example.com",
      "phone": "0123456789",
      "email": "contact@example.com",
      "comment": "Structure comment"
    }
  }
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Edit a structure

This route allows you to update an existing structure in your organization.

POST/api/v2/receive/structure/edit-structure

Request Body:

{
  "id": "structure_id",
  "name": "New structure name",
  "email": "new@example.com",
  "phone": "0123456789",
  "address1": "123 example street",
  "city": "City",
  "zipCode": "75000",
  "website": "https://www.example.com"
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Structure successfully updated",
    "structure": {
      "id": "structure_id",
      "name": "New structure name",
      "email": "new@example.com",
      "updatedAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors:

400Invalid or missing data
401Missing or invalid automation API key
404Structure not found
500Internal server error

Delete a structure

This route allows you to delete an existing structure in your organization.

POST/api/v2/receive/structure/delete-structure

Request Body:

{
  "id": "structure_id"
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Structure successfully deleted",
    "deletedAt": "2024-01-01T12:00:00Z"
  }
}

Possible Errors:

400Missing structure ID
401Missing or invalid automation API key
404Structure not found
500Internal server error

Get structures

This route allows you to retrieve all structures in your organization.

GET/api/v2/receive/structure/get-structures

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "structure_id",
      "name": "Structure name",
      "email": "email@example.com",
      "createdAt": "2024-01-01T12:00:00Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Sales

Create a sale

This route allows you to create a new sales deal in your organization.

POST/api/v2/receive/sales/create-sale

Request Body:

{
  "name": "Sale name (required)",
  "column": "stage_id (required)",
  "description": "Sale description (optional)",
  "value": "1000.50 (optional)",
  "success_rate": "85 (optional, 0-100)",
  "priority": "LOW|NORMAL|HIGH (optional, default: LOW)",
  "closeDate": "2024-12-31 (optional)",
  "assignedToId": "user_id (optional)",
  "contact": "email@example.com (optional)",
  "contactId": "contact_id (optional)"
}

Success Response:

{
  "status": 201,
  "data": {
    "message": "Vente créée avec succès",
    "salesDeal": {
      "id": "sale_id",
      "name": "Sale name",
      "priority": "LOW",
      "stageId": "stage_id",
      "organizationId": "org_id",
      "createdAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors:

400Le paramètre 'column' est obligatoire
400Le paramètre 'name' est obligatoire
400La priorité doit être 'LOW', 'NORMAL' ou 'HIGH'
400Le taux de succès doit être un nombre entre 0 et 100
401Missing or invalid automation API key
404Organization not found
500Erreur lors de la création de la vente

Update a sale

This route allows you to update an existing sales deal. Search by contact email.

PUT/api/v2/receive/sales/update-sale

Request Body:

{
  "contact_email": "email@example.com (required)",
  "name": "New sale name (optional)",
  "description": "New description (optional)",
  "column": "new_stage_id (optional)",
  "value": "1500.75 (optional)",
  "priority": "HIGH (optional)",
  "success_rate": "90 (optional, 0-100)"
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Vente mise à jour avec succès",
    "salesDeal": {
      "id": "sale_id",
      "name": "Updated sale name",
      "updatedAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors:

400Le paramètre 'contact_email' est obligatoire
400La priorité doit être 'LOW', 'NORMAL' ou 'HIGH'
400Le taux de succès doit être un nombre entre 0 et 100
401Missing or invalid automation API key
404Contact non trouvé avec cet email
404Aucune vente trouvée pour ce contact
500Internal server error

Delete a sale

This route allows you to delete an existing sales deal by contact email.

DELETE/api/v2/receive/sales/delete-sale

Request Body:

{
  "contact_email": "email@example.com (required)",
  "name": "Sale name (optional - if not provided, deletes the most recent sale)"
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Vente supprimée avec succès",
    "deletedSalesDeal": {
      "id": "deleted_sale_id",
      "name": "Sale name",
      "contactEmail": "email@example.com"
    }
  }
}

Possible Errors:

400Le paramètre 'contact_email' est obligatoire
401Missing or invalid automation API key
404Contact non trouvé avec cet email
404Aucune vente trouvée pour ce contact
500Internal server error

Get sales columns

This route allows you to retrieve all sales stages (columns) in your organization.

GET/api/v2/receive/sales/get-columns

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "stage_id",
      "name": "Qualification",
      "order": 1,
      "organizationId": "org_id"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Actions

Create an action

This route allows you to create a new action/task in your organization.

POST/api/v2/receive/actions/create-action

Request Body:

{
  "title": "Action title (optional)",
  "column": "stage_id (required)",
  "note": "Action description (optional)",
  "date": "2024-12-31 (optional)",
  "assigned_to": "user_id (optional)",
  "assign_contact": "email@example.com (optional)"
}

Success Response:

{
  "status": 201,
  "data": {
    "message": "Action ajoutée avec succès",
    "project": {
      "id": "action_id",
      "title": "Action title",
      "stageId": "stage_id",
      "organizationId": "org_id",
      "taskType": "OTHER",
      "createdAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors:

400Le paramètre 'column' est obligatoire
401Missing or invalid automation API key
404Organization not found
500Erreur lors de la création de l'action

Update an action

This route allows you to update an existing action/task. Search by contact email.

PUT/api/v2/receive/actions/update-action

Request Body:

{
  "contact_email": "email@example.com (required)",
  "title": "New action title (optional)",
  "column": "new_stage_id (optional)",
  "note": "New description (optional)",
  "date": "2024-12-31 (optional)",
  "assigned_to": "user_id (optional)"
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Action mise à jour avec succès",
    "project": {
      "id": "action_id",
      "title": "Updated action title",
      "updatedAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors:

400Le paramètre 'contact_email' est obligatoire
400Format de date invalide
401Missing or invalid automation API key
404Contact non trouvé avec cet email
404Aucune action trouvée pour ce contact
500Internal server error

Delete an action

This route allows you to delete an existing action/task by contact email (deletes the most recent action).

DELETE/api/v2/receive/actions/delete-action

Request Body:

{
  "contact_email": "email@example.com (required)"
}

Success Response:

{
  "status": 200,
  "data": {
    "message": "Activité supprimée avec succès",
    "deletedProject": {
      "id": "deleted_action_id",
      "title": "Action title",
      "contactEmail": "email@example.com"
    }
  }
}

Possible Errors:

400Le paramètre 'contact_email' est obligatoire
401Missing or invalid automation API key
404Contact non trouvé avec cet email
404Aucune activité trouvée pour ce contact
500Internal server error

Get action columns

This route allows you to retrieve all action stages (columns) in your organization.

GET/api/v2/receive/actions/get-columns

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "stage_id",
      "name": "To Do",
      "order": 1,
      "organizationId": "org_id"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Lists

Get lists

This route allows you to retrieve all lists in your organization with their complete details.

GET/api/v2/receive/lists/get-lists

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "list_id",
      "name": "Newsletter (NEWSLETTER)",
      "type": "NEWSLETTER",
      "title": "List title",
      "description": "List description",
      "imageUrl": "https://example.com/image.jpg",
      "linkCGU": "https://example.com/terms",
      "isTPE": true,
      "ctaText": "Subscribe now",
      "displayFields": [
        "email",
        "firstName",
        "lastName"
      ],
      "createdAt": "2024-01-01T12:00:00Z",
      "updatedAt": "2024-01-15T14:30:00Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Webhooks (GET)

Email

Added to list

This route allows you to receive a notification when a contact is added to a mailing list.

GET/api/v2/polling/email/added-to-list

Success Response:

{
  "status": 200,
  "data": {
    "id": "contact_id",
    "contactData": {
      "email": "contact@example.com",
      "firstName": "John",
      "lastName": "Doe"
    },
    "createdAt": "2024-01-01T12:00:00Z"
  }
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Removed from list

This route allows you to receive a notification when a contact is removed from a mailing list.

GET/api/v2/polling/email/deleted-from-list

Success Response:

{
  "status": 200,
  "data": {
    "id": "contact_id",
    "contactData": {
      "email": "contact@example.com",
      "firstName": "John",
      "lastName": "Doe"
    },
    "createdAt": "2024-01-01T12:00:00Z"
  }
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Contacts

New contacts

This route allows you to retrieve newly created contacts. Supports filtering by comment, lead_score and list_id.

GET/api/v2/polling/contact/user-created

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "zapier_record_id",
      "type": "LEAD",
      "civility": "Mr.",
      "first_name": "John",
      "last_name": "Doe",
      "birth_date": "1990-01-01T00:00:00.000Z",
      "sector": "Technology",
      "activity": "Developer",
      "status": "ACTIVE",
      "conversion_status": "Qualified",
      "lead_score": 85,
      "phone": "0123456789",
      "mobile": "0987654321",
      "phone_pro": "0112233445",
      "email": "john@example.com",
      "email2": "john.pro@example.com",
      "email_verified": true,
      "comment": "Contact qualified via form",
      "source": "Website",
      "listIds": [
        "list_1",
        "list_2"
      ],
      "linkedin": "https://linkedin.com/in/john",
      "facebook": "https://facebook.com/john",
      "instagram": "@john",
      "twitter": "@john",
      "website": "https://john.dev",
      "otherSocials": "GitHub: johndoe",
      "firstTouch": "2024-01-01T10:00:00.000Z",
      "lastTouch": "2024-01-15T14:30:00.000Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Edited contacts

This route allows you to retrieve contacts that have been edited.

GET/api/v2/polling/contact/user-edited

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "contact_id",
      "email": "contact@example.com",
      "firstName": "John",
      "lastName": "Doe",
      "updated_at": "2024-01-01T12:00:00Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Deleted contacts

This route allows you to retrieve contacts that have been deleted.

GET/api/v2/polling/contact/user-deleted

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "contact_id",
      "email": "contact@example.com",
      "firstName": "John",
      "lastName": "Doe",
      "deleted_at": "2024-01-01T12:00:00Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Structures

New structures

This route allows you to retrieve newly created structures.

GET/api/v2/polling/structures/structure-created

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "structure_id",
      "name": "Structure name",
      "created_at": "2024-01-01T12:00:00Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Edited structures

This route allows you to retrieve structures that have been edited.

GET/api/v2/polling/structures/structure-edited

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "structure_id",
      "name": "Structure name",
      "updated_at": "2024-01-01T12:00:00Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error

Deleted structures

This route allows you to retrieve structures that have been deleted.

GET/api/v2/polling/structures/structure-deleted

Success Response:

{
  "status": 200,
  "data": [
    {
      "id": "structure_id",
      "name": "Structure name",
      "deleted_at": "2024-01-01T12:00:00Z"
    }
  ]
}

Possible Errors:

401Missing or invalid automation API key
404Organization not found
500Internal server error