Skip to main content

Manage Lists

Create, organize, and manage contact lists to segment your audience for targeted email campaigns.

Goal

By the end of this guide you will be able to create lists within a contact structure, list all existing lists, update list names, delete lists, duplicate a list, and merge multiple lists into one.

Prerequisites

  • An API key with contacts:write scope (for full list management) or contacts:read scope (for read-only access)
  • Your API base URL (found on the Settings > API Keys page)
  • A contact structure ID — lists belong to a contact structure. Retrieve yours with GET /api/contact-structure (see Manage Custom Fields)

Steps

1. Create a list

Create a new list within a contact structure. The only required field is name.
curl -X POST https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Newsletter Subscribers"
  }'
Response (201 Created):
{
  "_id": "66f1a6e4698f1bca60425001",
  "name": "Newsletter Subscribers",
  "type": "static",
  "createdAt": "2026-03-28T14:30:00.000Z",
  "updatedAt": "2026-03-28T14:30:00.000Z",
  "__v": 0
}
Notes:
  • List type defaults to "static" (the only supported type currently)
  • List names can be up to 1,000 characters

2. List all lists (paginated)

Retrieve lists with pagination, sorting, and search support.
curl "https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists?page=1&size=25&sort=name:asc" \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
Response (200 OK):
{
  "total": 2,
  "records": [
    {
      "_id": "66f1a6e4698f1bca60425001",
      "name": "Newsletter Subscribers",
      "type": "static",
      "totalContacts": 1250,
      "totalCampaigns": 3,
      "createdAt": "2026-03-28T14:30:00.000Z",
      "updatedAt": "2026-03-28T14:30:00.000Z",
      "__v": 0
    },
    {
      "_id": "66f1a6e4698f1bca60425002",
      "name": "VIP Customers",
      "type": "static",
      "totalContacts": 85,
      "totalCampaigns": 7,
      "createdAt": "2026-03-20T10:00:00.000Z",
      "updatedAt": "2026-03-25T16:45:00.000Z",
      "__v": 1
    }
  ]
}
Query parameters:
ParameterTypeDescription
pageintegerPage number (1-indexed)
sizeintegerNumber of results per page
sortstringSort field and direction, e.g. name:asc, createdAt:desc
criteriastringSearch filter text to match list names
To retrieve all lists without pagination (returns _id, name, and type only):
curl https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists/all \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"

3. Get a single list

curl https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists/66f1a6e4698f1bca60425001 \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
Response (200 OK):
{
  "_id": "66f1a6e4698f1bca60425001",
  "name": "Newsletter Subscribers",
  "type": "static",
  "createdAt": "2026-03-28T14:30:00.000Z",
  "updatedAt": "2026-03-28T14:30:00.000Z",
  "__v": 0
}

4. Update a list

Rename a list by sending a PATCH request. You must include the current __v (version) value for optimistic concurrency control.
curl -X PATCH https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists/66f1a6e4698f1bca60425001 \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Monthly Newsletter",
    "__v": 0
  }'
Response (200 OK):
{
  "_id": "66f1a6e4698f1bca60425001",
  "name": "Monthly Newsletter",
  "type": "static",
  "createdAt": "2026-03-28T14:30:00.000Z",
  "updatedAt": "2026-03-28T15:00:00.000Z",
  "__v": 1
}
Important: The __v field prevents conflicts when multiple clients update the same list. Always send the current __v value from your last GET response. If another update occurred in the meantime, you will receive a 400 error with a ConcurrencyError type.

5. Delete a list

Delete a single list by ID:
curl -X DELETE https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists/66f1a6e4698f1bca60425001 \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
Response (204 No Content): Empty body. To delete multiple lists at once, send a DELETE to the lists collection endpoint:
curl -X DELETE https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
  -H "Content-Type: application/json" \
  -d '{
    "listIds": [
      "66f1a6e4698f1bca60425001",
      "66f1a6e4698f1bca60425002"
    ]
  }'
Response (204 No Content): Empty body.

6. Duplicate a list

Create a copy of an existing list (contacts are copied to the new list).
curl -X POST https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists/66f1a6e4698f1bca60425001/duplicate \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Newsletter Subscribers (Copy)"
  }'
Response (201 Created):
{
  "_id": "66f1a6e4698f1bca60425003",
  "name": "Newsletter Subscribers (Copy)",
  "type": "static",
  "createdAt": "2026-03-28T16:00:00.000Z",
  "updatedAt": "2026-03-28T16:00:00.000Z",
  "__v": 0
}

7. Merge lists

Combine two or more lists into a new list. Contacts from all source lists are added to the new list (duplicates are handled automatically).
curl -X POST https://api-us-west-2-c1.benchmarkemail.com/api/contact-structure/64a1b2c3d4e5f6a7b8c9d0e1/lists/merge \
  -H "X-API-Key: bme_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "All Subscribers (Merged)",
    "listIds": [
      "66f1a6e4698f1bca60425001",
      "66f1a6e4698f1bca60425002"
    ]
  }'
Response (200 OK):
{
  "_id": "66f1a6e4698f1bca60425004",
  "name": "All Subscribers (Merged)",
  "type": "static",
  "createdAt": "2026-03-28T16:30:00.000Z",
  "updatedAt": "2026-03-28T16:30:00.000Z",
  "__v": 0
}
Notes:
  • The source lists are not deleted; they remain intact
  • The merged list is a new list containing all unique contacts from the source lists
  • At least one listId is required

Common Errors

StatusErrorCauseFix
401UnauthorizedErrorInvalid or inactive API keyVerify your key in Settings > API Keys
403ForbiddenErrorKey lacks contacts:write scopeUpgrade the key’s scopes or create a new key with contacts:write
400ValidationErrorMissing required fields (e.g., name)Check request body against the schema requirements
400ConcurrencyError__v mismatch on update — another update occurred since your last readFetch the latest version with GET and retry with the current __v
404RecordNotFoundContact structure ID or list ID does not existVerify IDs match existing resources
429TooManyRequestsErrorRate limit or monthly quota exceededWait for the Retry-After period. See Rate Limits

Next Steps