Numberly
Lists

Populate a list

Once a list is created and published, its content is managed via operations. This asynchronous mechanism allows you to add, update, or delete contacts in bulk or individually via the API.

Available Operation Types

The API offers several modes of interaction with data via the type field in the request:

TypeDescriptionBehavior
insertStrict InsertionAdds only new contacts. Duplicates (based on the primary key) are ignored or generate an error depending on the configuration.
upsertUpdate or Insert(Recommended) Updates existing contacts and creates those that do not exist.
updateStrict UpdateUpdates only existing contacts. Unrecognized new contacts are ignored.
deleteDeletionDeletes contacts matching the provided identifiers.
replaceFull ReplacementCompletely clears the list and inserts the provided new data.

Method A: Import via JSON (Payload)

This method is ideal for real-time data streams or moderate volumes. Contact data is sent directly in the request body.

Endpoint

POST {subdomain}.api.numberly.com/v1/lists/{id}/operations

Payload example (Upsert)

curl -X POST 'https://{subdomain}.api.numberly.com/v1/lists/c2feab59-d124-4b69-9d81-579a76603c7b/operations' \
  -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "upsert",
  "data": [
    {
      "EMAIL": "client1@example.com",
      "FIRSTNAME": "Jean",
      "MOBILE": "+33612345678"
    },
    {
      "EMAIL": "client2@example.com",
      "FIRSTNAME": "Marie",
      "MOBILE": "+33687654321"
    }
  ]
}'

Note: The keys of the JSON objects in data (e.g., "EMAIL", "FIRSTNAME") must match exactly the column_name defined during the creation of the list.


Method B: Import via File (SFTP/S3)

For large data volumes, it is preferable to upload a file (CSV) to an SFTP server or an S3 bucket and ask the API to process it.

Endpoint

POST {subdomain}.api.numberly.com/v1/lists/{id}/operations

Payload Example (SFTP File)

{
  "type": "replace",
  "file_location": {
    "type": "SFTP",
    "path": "/imports/daily_users_20241027.csv"
  },
  "file_settings": {
    "delimiter": ";",
    "has_header": true,
    "encoding": "utf-8"
  }
}

File Parameters

  • file_location: Defines the source (SFTP or S3) and the path (path).
  • file_settings: Allows overriding the list's default settings (delimiter, header presence, encoding).

Operation Tracking

Creating an operation is an asynchronous process. The API responds immediately with a pending status and an operation identifier.

Creation Response (201 Created)

{
  "id": "op_889123-abc-456",
  "status": "pending",
  "created_at": "2024-10-27T14:30:00Z"
}

Status Check

Use the received ID to check if processing is complete.

Endpoint: GET {subdomain}.api.numberly.com/v1/lists/{id}/operations/{operation_id}

Response (Success):

{
  "id": "op_889123-abc-456",
  "status": "completed",
  "type": "upsert",
  "errors": null,
  "created_at": "2024-10-27T14:30:00Z",
  "updated_at": "2024-10-27T14:30:05Z"
}

Error Handling

If the status is failed, the errors field will contain the details (e.g., invalid column format, malformed email).