Free setup on annual plans

Sign up today!

End Users

API Reference: End Users endpoints

End users are the people who contact the customer: customers, leads and partners. Each end user has profile fields, one or more identifiers (an e-mail address, a phone number or another ID) and custom field values. AnswerPal uses the identifiers to recognise who sent a message.

Endpoints

  • GET /api/EndUsers
    Access: Bearer JWT
    List end users, paged. Query: pageNumber (default 1), pageSize (default 10), sortBy, sortOrder (asc or desc) and search.
  • POST /api/EndUsers
    Access: Bearer JWT
    Create an end user with its identifiers and custom field values. Answers 201 Created with the end user.
  • GET /api/EndUsers/byUid
    Access: Bearer JWT
    Find the end users with an identifier or customer reference. Query: uid. Returns a list, empty when nobody matches.
  • GET /api/EndUsers/{id}
    Access: Bearer JWT
    Return one end user.
  • PUT /api/EndUsers/{id}
    Access: Bearer JWT
    Update an end user, its identifiers and custom field values. Answers 204 No Content.
  • DELETE /api/EndUsers/{id}
    Access: Bearer JWT
    Delete an end user with its identifiers and custom field values. Refused with 409 while the end user has appointments. Answers 204 No Content.
  • GET /api/EndUsers/{id}/tickets
    Access: Bearer JWT
    The ticket history of an end user: the tickets whose identifier equals one of the end user’s identifiers or its customer reference. Paged like the ticket list.
  • POST /api/EndUserUIDs/assign
    Access: Bearer JWT
    Add one identifier to an existing end user. Answers 201 Created, or 200 OK when the identifier was already linked to that end user.

Fields

End user

  • endUserID (integer, response only)
  • name (string, response only)
    First name and last name together.
  • firstname, lastname, company (string or null)
  • gender (boolean or null)
  • customerType (string)
    Lead, Customer or Partner. Empty becomes Lead on create and keeps the current value on update.
  • customerRef (string or null)
    The ID of this person in your own CRM or ERP. It also counts as an identifier for lookups and ticket history.
  • lang, country (string or null)
  • street, houseNumber, postalCode, city (string or null)
  • otherContactDetails (string or null)
  • aiDocumentation (string or null)
    Notes about this person that the AI may use when it answers.
  • uids (array)
    The identifiers, see below.
  • customFields (object)
    Values of the customer’s end-user custom fields, by field name (see the Customer Custom Fields page).

Identifiers

  • endUserUIDID (integer)
    In responses. In an update: the identifier to change or delete; leave it out for a new one.
  • uidType (string, required)
    For example Email or Phone.
  • uid (string, required)
    The value. Spaces around it are removed. An Email identifier must be a valid e-mail address; a Phone identifier is stored as + followed by its digits, so send it in international format (+32 470 12 34 56 becomes +32470123456).
  • isPrimary (boolean)
  • markAsDeleted (boolean, update only)
    Remove this identifier.

Create and update

The update replaces the profile fields: send them all, a field you leave out is cleared (except customerType). Identifiers in the update are applied one by one: with an endUserUIDID they change or remove that identifier; without one they are added, or they update an existing identifier with the same type and value. Identifiers you do not send stay as they are.

In customFields, every key must be the name of an end-user custom field and is checked against the field’s type. A key with null removes that value; fields you leave out keep their value. An unknown field or an invalid value gives 400 Bad Request.

POST /api/EndUsers
Authorization: Bearer <token>
Content-Type: application/json

{
  "firstname": "An",
  "lastname": "Janssens",
  "company": "Example BV",
  "customerType": "Customer",
  "customerRef": "CRM-10045",
  "lang": "nl",
  "country": "BE",
  "uids": [
    { "uidType": "Email", "uid": "an.janssens@example.com", "isPrimary": true },
    { "uidType": "Phone", "uid": "+32 470 12 34 56", "isPrimary": false }
  ],
  "customFields": { "membership": "Gold" }
}
201 Created
Location: /api/EndUsers/812

{
  "endUserID": 812,
  "name": "An Janssens",
  "firstname": "An",
  "lastname": "Janssens",
  "company": "Example BV",
  "customerType": "Customer",
  "customerRef": "CRM-10045",
  "lang": "nl",
  "country": "BE",
  "uids": [
    { "endUserUIDID": 1201, "uid": "an.janssens@example.com", "uidType": "Email", "isPrimary": true },
    { "endUserUIDID": 1202, "uid": "+32470123456", "uidType": "Phone", "isPrimary": false }
  ],
  "customFields": { "membership": "Gold" }
}
PUT /api/EndUsers/812
Authorization: Bearer <token>
Content-Type: application/json

{
  "firstname": "An",
  "lastname": "Janssens",
  "company": "Example BV",
  "customerRef": "CRM-10045",
  "uids": [
    { "endUserUIDID": 1202, "uidType": "Phone", "uid": "+32470123456", "markAsDeleted": true },
    { "uidType": "Email", "uid": "an@example.org", "isPrimary": false }
  ],
  "customFields": { "membership": null }
}
POST /api/EndUserUIDs/assign
Authorization: Bearer <token>
Content-Type: application/json

{
  "endUserID": 812,
  "uid": "an.janssens@example.com",
  "uidType": "Email",
  "isPrimary": false
}

201 Created
{ "endUserUIDID": 1203, "uid": "an.janssens@example.com", "endUserID": 812 }

Lookup, search and ticket history

Lookup by identifier

GET /api/EndUsers/byUid?uid=... compares the value, with spaces around it removed, exactly with the stored identifiers and customer references of the customer. Look up phone numbers in their normalized form (+32470123456). More than one end user can match.

List and search

  • search
    Finds end users by the start of a word in their profile text, an identifier, the customer reference or a custom field value.
  • sortBy
    A field name such as lastname or city, DisplayName (first name, else last name, else company), or CustomFields.<fieldName> for an end-user custom field. An unknown field gives 400.
  • The answer has items, totalCount and totalPages.

Ticket history

GET /api/EndUsers/{id}/tickets takes the filters of the ticket list: pageNumber, pageSize, sortBy, sortOrder, status, customerRepID, channelType, channelIDs, uid, isClosed, isSpam and search. The end user in the path decides which tickets are included. The tickets have the fields of the Tickets page, with the topic names in topics.

Access and status codes

Every signed-in user of the customer can call these endpoints; they only see the end users of the customer in the token.

  • 200 OK, 201 Created, 204 No Content
    Success.
  • 400 Bad Request
    Validation errors (a list of field errors): an unknown customerType, a missing identifier, an invalid e-mail identifier, an unknown custom field or invalid value, or an unknown sort field.
  • 404 Not Found
    No end user with that ID for this customer.
  • 409 Conflict
    The end user has appointments and cannot be deleted.

Best practices

  • Put the ID from your CRM or ERP in customerRef, so you can find the end user back with byUid.
  • Add every known e-mail address and phone number as an identifier; AnswerPal recognises a sender by them.
  • Read the end user before an update and send the full profile back, so no field is cleared by accident.

FAQ

Yes. Add them on create, in an update or one at a time with POST /api/EndUserUIDs/assign.

On the exact value, after removing surrounding spaces, against the identifiers and the customer reference. Phone numbers are stored in normalized form, so look them up in that form.

When the same value is already linked to that end user, nothing changes and the answer is 200 OK.

Lead, Customer and Partner. A new end user without a type becomes Lead.

Need more help?

Table of Contents

AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.

Contact

For all support, sales, and partnership inquiries, email us at info@answerpal.eu

AnswerPal
Bisschoppenhoflaan 380
2100 Antwerp
Belgium

+32.36416685

BE 0862.692.858