Populate a list
Available Operation Types
The API offers several modes of interaction with data via the type field in the request:
| Type | Description | Behavior |
|---|---|---|
insert | Strict Insertion | Adds only new contacts. Duplicates (based on the primary key) are ignored or generate an error depending on the configuration. |
upsert | Update or Insert | (Recommended) Updates existing contacts and creates those that do not exist. |
update | Strict Update | Updates only existing contacts. Unrecognized new contacts are ignored. |
delete | Deletion | Deletes contacts matching the provided identifiers. |
replace | Full Replacement | Completely 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 thecolumn_namedefined 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 (SFTPorS3) 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).
Create a list
This technical guide details the process of programmatically creating contact lists via the NMP API. Currently, the API supports the management of static lists.
Retrieve list members
After creating a list and executing import operations (insertion/update), it is essential to be able to verify the stored data. The API allows you to retrieve list members with pagination and filtering via the retrieval endpoint.