API v2.2 Documentation

Complete documentation for the v2.2 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

Obtenir votre clé API

Accédez à la page des paramètres pour générer ou récupérer votre clé API d'automatisation

Accéder

Endpoint

/api/v2/identify-user

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Actions (POST)

Endpoints to send data to NextLead CRM

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

Endpoint

/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

201
{
  "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

400

Invalid or missing data

401

Missing or invalid automation API key

404

Organization/List/Establishment not found

409

A contact with this email already exists

500

Error 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. Use structureId + structureType to link a structure.
POST

Endpoint

/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,
      "structureId": "structure_id (optional)",
      "structureType": "main|secondary|both (optional, default: main — requires structureId)",
      "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

200
{
  "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

400

Contact email or LinkedIn URL required

401

Missing or invalid automation API key

404

Contact not found with provided criteria

500

Internal server error

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

Endpoint

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

Request Body

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

Success Response

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

Possible Errors

400

Missing or invalid contact email address or LinkedIn account

401

Missing or invalid automation API key

404

No contact found with this email/LinkedIn

500

Internal server error

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

Endpoint

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

Request Body

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

Success Response

200
{
  "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

400

Missing contact email or LinkedIn URL

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Create activity for a contact
This route allows you to create one or several activities (tasks) for an existing contact. Search by email (contact_email) or LinkedIn (contact_linkedin). Pass a single object in 'activity' or an array in 'activities'.
POST

Endpoint

/api/v2/receive/contact/create-activity

Request Body

{
  "contact_email": "email@example.com (required if no contact_linkedin)",
  "contact_linkedin": "https://linkedin.com/in/profile (required if no contact_email)",
  "assigned_to": "user_id (optional — global default for all activities)",
  "activities": [
    {
      "title": "Activity title (optional)",
      "taskType": "EMAIL|CALL|MEETING|LUNCH|REMINDER|MESSAGE|OTHER (optional)",
      "column": "stage_id (optional)",
      "note": "Activity description (optional)",
      "date": "2024-12-31 (optional)",
      "priority": "URGENCY|HIGH|NORMAL|LOW|SOON|LATER (optional)",
      "assigned_to": "user_id (optional — overrides global)"
    }
  ]
}

Success Response

201
{
  "status": 201,
  "data": {
    "message": "Activité créée avec succès",
    "activities": [
      {
        "id": "activity_id",
        "title": "Activity title",
        "taskType": "OTHER",
        "createdAt": "2024-01-01T12:00:00Z"
      }
    ]
  }
}

Possible Errors

400

Au moins un identifiant contact est requis (contact_email ou contact_linkedin)

400

Aucune activité à créer

401

Missing or invalid automation API key

404

Contact non trouvé avec les identifiants fournis

500

Internal server error

Get upcoming activities for a contact
This route allows you to retrieve all upcoming (non-finished, non-archived) activities for a contact. Search by email (contact_email) or LinkedIn (contact_linkedin).
POST

Endpoint

/api/v2/receive/contact/get-activities

Request Body

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

Success Response

200
{
  "status": 200,
  "data": {
    "contact_id": "contact_id",
    "contact_email": "john@example.com",
    "total": 1,
    "activities": [
      {
        "id": "activity_id",
        "title": "Follow-up call",
        "task_type": "CALL",
        "priority": "HIGH",
        "note": "Discuss proposal",
        "deadline": "2024-12-31T00:00:00.000Z",
        "finished_at": null,
        "is_archived": false,
        "is_finished": false,
        "stage": {
          "id": "stage_id",
          "name": "To Do",
          "color": "#3b82f6"
        },
        "assigned_to": [
          {
            "id": "user_id",
            "name": "John Doe",
            "email": "john@example.com",
            "image": null
          }
        ],
        "created_at": "2024-01-01T12:00:00.000Z",
        "updated_at": "2024-01-01T12:00:00.000Z"
      }
    ]
  }
}

Possible Errors

400

Au moins un identifiant contact est requis (contact_email ou contact_linkedin)

401

Missing or invalid automation API key

404

Organisation non trouvée

404

Contact non trouvé avec les identifiants fournis

500

Internal server error

Get notes for a contact
This route allows you to retrieve all non-archived notes for a contact. Search by email (contact_email) or LinkedIn (contact_linkedin).
POST

Endpoint

/api/v2/receive/contact/get-contact-notes

Request Body

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

Success Response

200
{
  "status": 200,
  "data": {
    "contact_id": "contact_id",
    "contact_email": "john@example.com",
    "total": 1,
    "notes": [
      {
        "id": "note_id",
        "title": "Note title",
        "content": "Note content",
        "pinned": false,
        "created_by": {
          "id": "user_id",
          "name": "John Doe",
          "email": "john@example.com",
          "image": null
        },
        "created_at": "2024-01-01T12:00:00.000Z",
        "updated_at": "2024-01-01T12:00:00.000Z"
      }
    ]
  }
}

Possible Errors

400

Au moins un identifiant contact est requis (contact_email ou contact_linkedin)

401

Missing or invalid automation API key

404

Organisation non trouvée

404

Contact non trouvé avec les identifiants fournis

500

Internal server error

Filter contacts
This route allows you to filter contacts using advanced filter criteria (same engine as the CRM UI filters).
POST

Endpoint

/api/v2/receive/contact/filter-contacts

Request Body

{
  "filters": [
    {
      "field": "lead_score",
      "operator": "gte",
      "value": "80"
    }
  ]
}

Success Response

200
{
  "status": 200,
  "data": {
    "message": "contacts filtrés avec succès",
    "count": 1,
    "data": [
      {
        "id": "contact_id",
        "firstName": "John",
        "lastName": "Doe",
        "email": "john@example.com",
        "phone": "0123456789",
        "mobile": "0987654321",
        "lead_score": 85,
        "status": "ACTIVE",
        "createdAt": "2024-01-01T12:00:00.000Z",
        "updatedAt": "2024-01-15T14:30:00.000Z"
      }
    ]
  }
}

Possible Errors

400

format de filtres invalide

401

Missing or invalid automation API key

404

organisation non trouvée

500

Internal server error

Link a contact to a structure
This route allows you to link a contact to a structure. By default sets the structure as main. Use linkAsSecondary to add as secondary only. Identify contact and structure by multiple criteria.
POST

Endpoint

/api/v2/receive/contact/link-to-structure

Request Body

{
  "contactId": "contact_id (optional)",
  "email": "email@example.com (optional)",
  "linkedin_url": "https://linkedin.com/in/profile (optional)",
  "phone": "0123456789 (optional)",
  "mobile": "0987654321 (optional)",
  "customField": {
    "customFieldTypeId": "custom_field_type_id",
    "value": "field_value"
  },
  "structureId": "structure_id (optional)",
  "siret": "12345678901234 (optional)",
  "structure_name": "Structure name (optional)",
  "structure_email": "contact@structure.com (optional)",
  "structureCustomField": {
    "customFieldTypeId": "custom_field_type_id",
    "value": "field_value"
  },
  "mainStructure": "true|false (optional — set as main structure)",
  "main_structure": "true|false (alias)",
  "set_as_main_structure": "true|false (alias)",
  "linkAsSecondary": "true|false (optional — link as secondary only)"
}

Success Response

200
{
  "status": 200,
  "data": {
    "message": "Contact lié à la structure avec succès (structure principale définie)",
    "contact": {
      "id": "contact_id",
      "firstName": "John",
      "lastName": "Doe",
      "email": "john@example.com",
      "mainStructure": {
        "id": "structure_id",
        "name": "Structure name"
      },
      "structures": [
        {
          "id": "structure_id",
          "name": "Structure name"
        }
      ]
    },
    "structure": {
      "id": "structure_id",
      "name": "Structure name",
      "siret": "12345678901234",
      "email": "contact@structure.com"
    },
    "alreadyLinked": false
  }
}

Possible Errors

400

Au moins un identifiant de contact et un identifiant de structure doivent être fournis

400

Données invalides

401

Missing or invalid automation API key

404

Contact non trouvé

404

Structure non trouvée

500

Internal 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

Endpoint

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

Query Parameters

{
  "customFieldSetId": "group_id (optional) - get fields from specific group only"
}

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Structures

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

Endpoint

/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

201
{
  "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

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

/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

200
{
  "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

400

Invalid or missing data

401

Missing or invalid automation API key

404

Structure not found

500

Internal server error

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

Endpoint

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

Request Body

{
  "id": "structure_id"
}

Success Response

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

Possible Errors

400

Missing structure ID

401

Missing or invalid automation API key

404

Structure not found

500

Internal server error

Get structures
This route allows you to retrieve all structures in your organization. Supports search, pagination with limit and offset.
GET

Endpoint

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

Query Parameters

{
  "search": "search term (optional) - filter by name or siret (alias: searchTerm)",
  "limit": "100 (optional, max 500) - number of results",
  "offset": "0 (optional) - number of results to skip"
}

Success Response

200
{
  "status": 200,
  "data": {
    "message": "Structures récupérées avec succès",
    "count": 1,
    "data": [
      {
        "id": "structure_id",
        "name": "Structure name",
        "siret": "12345678901234",
        "coordination": null,
        "group": null,
        "headOffice": null,
        "ues": null,
        "createdAt": "2024-01-01T12:00:00Z",
        "updatedAt": "2024-01-01T12:00:00Z"
      }
    ]
  }
}

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Get a single structure
This route allows you to search for a single structure by id, name, siret, email, or phone. Returns 409 if multiple results match.
GET

Endpoint

/api/v2/receive/structure/get-single-structure

Query Parameters

{
  "id": "structure_id (optional)",
  "name": "Structure name (optional, case-insensitive)",
  "siret": "12345678901234 (optional)",
  "email": "contact@example.com (optional, case-insensitive)",
  "phone": "0123456789 (optional, alias: phoneNumber)"
}

Success Response

200
{
  "status": 200,
  "data": {
    "message": "Structure trouvée",
    "found": true,
    "data": {
      "id": "structure_id",
      "name": "Structure name",
      "siret": "12345678901234",
      "email": "contact@example.com",
      "phone": "0123456789",
      "address1": "123 example street",
      "address2": null,
      "zipCode": "75000",
      "city": "Paris",
      "website": "https://www.example.com",
      "comment": null,
      "detailedDescription": null,
      "groups": [
        {
          "id": "group_id",
          "name": "Group name"
        }
      ],
      "createdAt": "2024-01-01T12:00:00Z",
      "updatedAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors

400

Au moins un paramètre est requis : 'id', 'name', 'siret', 'email' ou 'phone'

401

Missing or invalid automation API key

404

Structure non trouvée

409

Plusieurs structures correspondent. Ajoutez des paramètres pour affiner.

500

Internal server error

Get structure custom fields
This route allows you to retrieve all custom fields for structures in your organization. Use the returned IDs in customField matchers.
GET

Endpoint

/api/v2/receive/structure/get-custom-fields

Query Parameters

{
  "customFieldSetId": "group_id (optional) - get fields from specific group only"
}

Success Response

200
{
  "status": 200,
  "data": [
    {
      "id": "custom_field_type_id_1",
      "name": "Number of employees",
      "type": "string",
      "groupId": "custom_field_set_id",
      "groupName": "Structure Information"
    }
  ]
}

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Filter structures
This route allows you to filter structures using advanced filter criteria (same engine as the CRM UI filters).
POST

Endpoint

/api/v2/receive/structure/filter-structures

Request Body

{
  "filters": [
    {
      "field": "name",
      "operator": "contains",
      "value": "Tech"
    }
  ]
}

Success Response

200
{
  "status": 200,
  "data": {
    "message": "structures filtrées avec succès",
    "count": 1,
    "data": [
      {
        "id": "structure_id",
        "name": "Tech Corp",
        "siret": "12345678901234",
        "siren": "123456789",
        "nafCode": "6201Z",
        "sector": "Technology",
        "coordination": null,
        "group": null,
        "headOffice": null,
        "ues": null,
        "createdAt": "2024-01-01T12:00:00.000Z",
        "updatedAt": "2024-01-15T14:30:00.000Z"
      }
    ]
  }
}

Possible Errors

400

format de filtres invalide

401

Missing or invalid automation API key

404

organisation non trouvée

500

Internal server error

Link a structure to a contact
This route allows you to link a structure to a contact. Automatically sets main structure if the contact has none. Supports mainStructure/main_structure/set_as_main_structure flags.
POST

Endpoint

/api/v2/receive/structure/link-to-contact

Request Body

{
  "structureId": "structure_id (optional)",
  "siret": "12345678901234 (optional)",
  "structure_name": "Structure name (optional)",
  "structure_email": "contact@structure.com (optional)",
  "structureCustomField": {
    "customFieldTypeId": "custom_field_type_id",
    "value": "field_value"
  },
  "contactId": "contact_id (optional)",
  "email": "email@example.com (optional)",
  "linkedin_url": "https://linkedin.com/in/profile (optional)",
  "phone": "0123456789 (optional)",
  "mobile": "0987654321 (optional)",
  "customField": {
    "customFieldTypeId": "custom_field_type_id",
    "value": "field_value"
  },
  "mainStructure": "true|false (optional — force set as main structure)",
  "main_structure": "true|false (alias)",
  "set_as_main_structure": "true|false (alias)"
}

Success Response

200
{
  "status": 200,
  "data": {
    "message": "Structure liée au contact avec succès",
    "structure": {
      "id": "structure_id",
      "name": "Structure name",
      "siret": "12345678901234",
      "email": "contact@structure.com"
    },
    "contact": {
      "id": "contact_id",
      "firstName": "John",
      "lastName": "Doe",
      "email": "john@example.com",
      "mainStructure": {
        "id": "structure_id",
        "name": "Structure name"
      },
      "structures": [
        {
          "id": "structure_id",
          "name": "Structure name"
        }
      ],
      "linkedin": "https://linkedin.com/in/johndoe"
    },
    "alreadyLinked": false,
    "mainStructureUpdated": true
  }
}

Possible Errors

400

Au moins un identifiant de structure et un identifiant de contact sont requis

400

Données invalides

401

Missing or invalid automation API key

404

Structure non trouvée

404

Contact non trouvé

500

Internal server error

Sales

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

Endpoint

/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

201
{
  "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

400

Le paramètre 'column' est obligatoire

400

Le paramètre 'name' est obligatoire

400

La priorité doit être 'LOW', 'NORMAL' ou 'HIGH'

400

Le taux de succès doit être un nombre entre 0 et 100

401

Missing or invalid automation API key

404

Organization not found

500

Erreur 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 and optionally by exact sale name.
PUT

Endpoint

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

Request Body

{
  "contact_email": "email@example.com (required)",
  "search_name": "Current sale name used to find the deal (optional, exact match)",
  "name": "New sale name (optional)",
  "description": "New description (optional)",
  "column": "new_stage_id (optional)",
  "value": "1500.75 (optional, 0 is accepted)",
  "priority": "HIGH (optional)",
  "success_rate": "90 (optional, 0-100). Alias supported: successRate, sucessRate",
  "closeDate": "2024-12-31 (optional)",
  "assignedToId": "user_id (optional)"
}

Success Response

200
{
  "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

400

Le paramètre 'contact_email' est obligatoire

400

La priorité doit être 'LOW', 'NORMAL' ou 'HIGH'

400

Le taux de succès doit être un nombre entre 0 et 100

400

Format de date invalide

401

Missing or invalid automation API key

404

Contact non trouvé avec cet email

404

Aucune vente trouvée avec ce nom pour ce contact

404

Aucune vente trouvée pour ce contact

500

Internal server error

Delete a sale
This route allows you to delete an existing sales deal by contact email.
DELETE

Endpoint

/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

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

Possible Errors

400

Le paramètre 'contact_email' est obligatoire

401

Missing or invalid automation API key

404

Contact non trouvé avec cet email

404

Aucune vente trouvée pour ce contact

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Actions

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

Endpoint

/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

201
{
  "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

400

Le paramètre 'column' est obligatoire

401

Missing or invalid automation API key

404

Organization not found

500

Erreur 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 and optionally by exact task name.
PUT

Endpoint

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

Request Body

{
  "contact_email": "email@example.com (required)",
  "search_title": "Current task name used to find the action (optional, exact match)",
  "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

200
{
  "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

400

Le paramètre 'contact_email' est obligatoire

400

Format de date invalide

401

Missing or invalid automation API key

404

Contact non trouvé avec cet email

404

Aucune action trouvée avec ce nom pour ce contact

404

Aucune action trouvée pour ce contact

500

Internal server error

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

Endpoint

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

Request Body

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

Success Response

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

Possible Errors

400

Le paramètre 'contact_email' est obligatoire

401

Missing or invalid automation API key

404

Contact non trouvé avec cet email

404

Aucune activité trouvée pour ce contact

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Groups

Create a group
This route allows you to create a new group (REGULAR or SEGMENT) in your organization.
POST

Endpoint

/api/v2/receive/groups/create-groups

Request Body

{
  "name": "Group name (required)",
  "type": "REGULAR|SEGMENT (optional, default: REGULAR)",
  "description": "Group description (optional)"
}

Success Response

201
{
  "status": 201,
  "data": {
    "message": "Groupe créé avec succès",
    "data": {
      "id": "group_id",
      "name": "Group name",
      "type": "REGULAR",
      "description": null,
      "createdAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors

400

Le champ 'name' est requis

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Get groups
This route allows you to retrieve all groups of a given type (REGULAR or SEGMENT) in your organization.
GET

Endpoint

/api/v2/receive/groups/get-groups

Query Parameters

{
  "type": "REGULAR|SEGMENT (optional, default: REGULAR)"
}

Success Response

200
{
  "status": 200,
  "data": [
    {
      "id": "group_id",
      "name": "Group name",
      "type": "REGULAR",
      "structureCount": 5,
      "createdAt": "2024-01-01T12:00:00Z",
      "updatedAt": "2024-01-01T12:00:00Z"
    }
  ]
}

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Lists

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

Endpoint

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

Success Response

200
{
  "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

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Create a list
This route allows you to create a new list in your organization. Supported types: REGULAR, AUDIENCE, SEGMENT, PROSPECTION.
POST

Endpoint

/api/v2/receive/lists/create-list

Request Body

{
  "name": "List name (required)",
  "type": "REGULAR|AUDIENCE|SEGMENT|PROSPECTION (optional, default: REGULAR)"
}

Success Response

201
{
  "status": 201,
  "data": {
    "message": "Liste créée avec succès",
    "data": {
      "id": "list_id",
      "name": "List name",
      "type": "REGULAR",
      "createdAt": "2024-01-01T12:00:00Z"
    }
  }
}

Possible Errors

400

Le champ 'name' est requis

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Forms

Get form
This route allows you to retrieve a form by list ID with all its fields and template configuration.
GET

Endpoint

/api/v2/receive/forms/get-form

Query Parameters

{
  "listId": "list_id (required)"
}

Success Response

200
{
  "status": 200,
  "data": {
    "id": "list_id",
    "name": "Newsletter form",
    "type": "AUDIENCE",
    "fields": [
      {
        "id": "field_id",
        "label": "Email",
        "name": "email",
        "type": "EMAIL",
        "placeholder": "Enter your email",
        "helpText": "We'll never share your email",
        "defaultValue": null,
        "config": {},
        "validations": {},
        "order": 0,
        "column": null,
        "width": null,
        "isVisible": true,
        "isRequired": true,
        "mapsToContactField": "email",
        "createdAt": "2024-01-01T12:00:00Z",
        "updatedAt": "2024-01-01T12:00:00Z",
        "options": [],
        "dependsOnFields": []
      },
      {
        "id": "field_id_2",
        "label": "Interest",
        "name": "interest",
        "type": "SELECT",
        "placeholder": "",
        "helpText": null,
        "defaultValue": null,
        "config": {
          "options": [
            {
              "id": "option_id",
              "label": "Tech",
              "value": "tech"
            },
            {
              "id": "option_id_2",
              "label": "Marketing",
              "value": "marketing"
            }
          ]
        },
        "validations": {},
        "order": 1,
        "column": null,
        "width": null,
        "isVisible": true,
        "isRequired": true,
        "mapsToContactField": null,
        "createdAt": "2024-01-01T12:00:00Z",
        "updatedAt": "2024-01-01T12:00:00Z",
        "options": [
          {
            "id": "option_id",
            "label": "Tech",
            "value": "tech",
            "order": 0,
            "createdAt": "2024-01-01T12:00:00Z",
            "updatedAt": "2024-01-01T12:00:00Z"
          },
          {
            "id": "option_id_2",
            "label": "Marketing",
            "value": "marketing",
            "order": 1,
            "createdAt": "2024-01-01T12:00:00Z",
            "updatedAt": "2024-01-01T12:00:00Z"
          }
        ],
        "dependsOnFields": []
      }
    ],
    "template": {
      "id": "template_id",
      "name": "Template for Newsletter form",
      "type": "SINGLE_COLUMN",
      "title": "Subscribe to our newsletter",
      "description": "Stay updated with our latest news",
      "submissionName": null,
      "successMessage": "Thank you for subscribing!",
      "successTitle": "Success",
      "successImageUrl": null,
      "color": "#3b82f6",
      "submitButtonColor": "#1e40af",
      "imageUrl": "https://example.com/image.jpg",
      "imagePosition": "LEFT",
      "paginationMode": "SCROLLABLE",
      "createdAt": "2024-01-01T12:00:00Z",
      "updatedAt": "2024-01-01T12:00:00Z"
    },
    "imageUrl": "https://example.com/image.jpg"
  }
}

Possible Errors

400

The 'listId' parameter is required

401

Missing or invalid automation API key

404

Organization not found

404

Form not found

500

Internal server error

Create a form
This route allows you to create a new audience list with its form fields and template configuration.
POST

Endpoint

/api/v2/receive/forms/create-form

Request Body

{
  "name": "Newsletter form (required)",
  "title": "Subscribe to our newsletter (optional)",
  "description": "Stay updated with our latest news (optional)",
  "templateType": "SINGLE_COLUMN|DOUBLE_COLUMN (optional, default: SINGLE_COLUMN)",
  "successMessage": "Thank you for subscribing! (optional)",
  "successTitle": "Success (optional)",
  "color": "#3b82f6 (optional)",
  "submitButtonColor": "#1e40af (optional)",
  "fields": [
    {
      "type": "TEXT|TEXTAREA|EMAIL|TEL|NUMBER|CHECKBOX|BOOLEAN|RADIO|SELECT|MULTI_SELECT|DATE|TIME|DATETIME|HIDDEN|FILE|RATING|FIRSTNAME|LASTNAME (required)",
      "label": "Email (required)",
      "isRequired": "true|false (optional, default: false)",
      "placeholder": "Enter your email (optional)",
      "helpText": "We'll never share your email (optional)",
      "defaultValue": "default@example.com (optional)",
      "options": [
        {
          "label": "Option label (required for SELECT/RADIO/MULTI_SELECT/CHECKBOX)",
          "value": "option_value (required for SELECT/RADIO/MULTI_SELECT/CHECKBOX)"
        }
      ],
      "config": "{} (optional) - Additional configuration (accept, maxSize, min, max, step, rows, maxLength, levels, symbolType)",
      "validations": "{} (optional) - Validation rules (required, minLength, maxLength, pattern, min, max, customMessage)",
      "mapsToContactField": "firstName|lastName|email|phone (optional)"
    }
  ]
}

Success Response

201
{
  "status": 201,
  "data": {
    "message": "Formulaire créé avec succès",
    "data": {
      "id": "list_id",
      "name": "Newsletter form",
      "type": "AUDIENCE",
      "fields": [
        {
          "id": "field_id",
          "listId": "list_id",
          "label": "Email",
          "name": "email",
          "type": "EMAIL",
          "placeholder": "Enter your email",
          "helpText": "We'll never share your email",
          "defaultValue": null,
          "config": {},
          "validations": {},
          "order": 0,
          "column": null,
          "width": null,
          "isVisible": true,
          "isRequired": true,
          "mapsToContactField": "email",
          "createdAt": "2024-01-01T12:00:00Z",
          "updatedAt": "2024-01-01T12:00:00Z"
        },
        {
          "id": "field_id_2",
          "listId": "list_id",
          "label": "Interest",
          "name": "interest",
          "type": "SELECT",
          "placeholder": null,
          "helpText": null,
          "defaultValue": null,
          "config": {
            "options": [
              {
                "id": "option_id",
                "label": "Tech",
                "value": "tech"
              },
              {
                "id": "option_id_2",
                "label": "Marketing",
                "value": "marketing"
              }
            ]
          },
          "validations": {},
          "order": 1,
          "column": null,
          "width": null,
          "isVisible": true,
          "isRequired": true,
          "mapsToContactField": null,
          "createdAt": "2024-01-01T12:00:00Z",
          "updatedAt": "2024-01-01T12:00:00Z"
        }
      ],
      "template": {
        "id": "template_id",
        "name": "Template for Newsletter form",
        "type": "SINGLE_COLUMN",
        "title": "Subscribe to our newsletter",
        "description": "Stay updated with our latest news",
        "submissionName": null,
        "successMessage": "Thank you for subscribing!",
        "successTitle": "Success",
        "successImageUrl": null,
        "color": "#3b82f6",
        "submitButtonColor": "#1e40af",
        "imageUrl": null,
        "imagePosition": "LEFT",
        "paginationMode": "SCROLLABLE",
        "createdAt": "2024-01-01T12:00:00Z",
        "updatedAt": "2024-01-01T12:00:00Z"
      }
    }
  }
}

Possible Errors

400

The 'name' parameter is required

400

The 'templateType' parameter must be 'SINGLE_COLUMN' or 'DOUBLE_COLUMN'

400

The field at index X has an invalid type

400

The field at index X must have a valid 'label'

400

The 'fields' parameter must be an array

400

The field at index X has invalid 'options' (must be an array)

400

The option at index X of the field at index Y must have valid 'label' and 'value'

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Webhooks (GET)

Endpoints to retrieve data from NextLead CRM

Email

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Contacts

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

Endpoint

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

Query Parameters

{
  "comment": "text (optional) - filter by comment",
  "lead_score": "85 (optional) - contacts with higher score",
  "list_id": "list_id (optional, multiple) - filter by list"
}

Success Response

200
{
  "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

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

Structures

New structures
This route allows you to retrieve newly created structures.
GET

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error

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

Endpoint

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

Success Response

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

Possible Errors

401

Missing or invalid automation API key

404

Organization not found

500

Internal server error