Skip to content

Contact List — Contact

A contact is an entity within a contact list holding data necessary to generate and send messages.

Endpoints

Method URL
GET /contact_list/<list>/contact/<contact>
POST /contact_list/<list>/contact
PUT /contact_list/<list>/contact/<contact>
DELETE /contact_list/<list>/contact/<contact>

GET /contact_list/<list>/contact/<contact>

Payload: No payload.

Returns: The contact.

Example:

curl -u "username:api_key" -H "Accept: application/json" \
  https://app.duo.pt/contact_list/{list_id}/contact/{contact_id}

Response:

{
  "success": true,
  "data": {
    "contact_list_contact": {
      "id": 1,
      "list": 1,
      "email": "contact@example.com",
      "telephone": "351910000001",
      "subscription_status": "SUBSCRIBED",
      "bouncing": false
    }
  }
}

POST /contact_list/<list>/contact

Note

A contact must have at least a phone number or an email. Lists without double opt-in cannot have contacts with PENDING subscription status. Custom fields are always optional.

Parameter Type Description
email string Contact email
telephone string Contact telephone number
subscription_status string One of SUBSCRIBED, PENDING, UNSUBSCRIBED
bouncing boolean Whether the contact is marked as not receiving payloads
custom[<id>] string Value for a custom field. Replace <id> with the custom field ID (e.g. custom[42]). May appear multiple times for different IDs.

Returns: The new contact.

Example:

curl -u "username:api_key" -H "Accept: application/json" \
  -d "email=contact@example.com&telephone=351910000000&subscription_status=SUBSCRIBED" \
  https://app.duo.pt/contact_list/{list_id}/contact

Response:

{
  "success": true,
  "data": {
    "contact_list": {
      "id": 1,
      "owner": 1,
      "name": "Example...",
      "default_email_out": null,
      "unsubscribe_message": "You have been unsubscribed.",
      "email_out_custom_fields": null,
      "double_optin": false,
      "optout_allowed": false,
      "optout_category": null,
      "optin_email": null,
      "optin_sms": null,
      "shared_with_children": false,
      "read_shared_with_children": false,
      "segments": null
    },
    "transactionalAutomationNodes": [],
    "contact_list_contact": {
      "id": 1,
      "list": 1,
      "email": "contact@example.com",
      "telephone": "351910000001",
      "subscription_status": "SUBSCRIBED",
      "bouncing": false
    },
    "success": true
  }
}

PUT /contact_list/<list>/contact/<contact>

Same payload as POST.

Aviso

PUT resets subscription_status to PENDING when parameters are sent as application/x-www-form-urlencoded. To preserve the existing status, send the PUT request with Content-Type: application/json and include "subscription_status": "SUBSCRIBED" in the JSON body.

Returns: The edited contact.

Example:

curl -u "username:api_key" -H "Accept: application/json" -X PUT \
  -d "email=updated@example.com&subscription_status=SUBSCRIBED&bouncing=false" \
  https://app.duo.pt/contact_list/{list_id}/contact/{contact_id}

Response:

{
  "success": true,
  "data": {
    "contact_list": {
      "id": 1,
      "owner": 1,
      "name": "Example...",
      "default_email_out": null,
      "unsubscribe_message": "You have been unsubscribed.",
      "email_out_custom_fields": null,
      "double_optin": false,
      "optout_allowed": false,
      "optout_category": null,
      "optin_email": null,
      "optin_sms": null,
      "shared_with_children": false,
      "read_shared_with_children": false,
      "segments": null
    },
    "contact_list_contact": {
      "id": 1,
      "list": 1,
      "email": "contact@example.com",
      "telephone": "351910000001",
      "subscription_status": "PENDING",
      "bouncing": false
    },
    "success": true
  }
}

DELETE /contact_list/<list>/contact/<contact>

Payload: No payload.

Returns: The deleted contact.

Example:

curl -u "username:api_key" -H "Accept: application/json" -X DELETE \
  https://app.duo.pt/contact_list/{list_id}/contact/{contact_id}

Response:

{
  "success": true,
  "data": {
    "contact_list_contact": {
      "id": 1,
      "list": 1,
      "email": "contact@example.com",
      "telephone": "351910000001",
      "subscription_status": "PENDING",
      "bouncing": false
    }
  }
}