Add subscribers and endpoints

Updated 16 Nov 20265 min read

Send a customer's recorded people to Focus through the API, with their names and their phone numbers, email addresses or Teams user IDs, in one request.

Once a customer's account exists, Focus needs to know who is being recorded. That is two things:

  • Subscribers. The people in your customer's organisation, each with a name. See Subscribers.

  • Endpoints. The identities a person is recorded on: a phone number, an email address or a Microsoft Teams user ID. Each endpoint belongs to one person.

A recording is matched to a person through the endpoint it was made on. If an endpoint has no owner, its recordings cannot be shown against a person.

You can add subscribers by hand in the portal, on the People screen. This page covers doing it through the API, from your own provisioning system.

One request, or two#

You can send names and endpoints together, in a single request. POST /client/people.upsert takes a list of people, and each person carries their own list of endpoints. This is the recommended way.

There is also an endpoint-only call, POST /client/people/endpoint/upsert. It carries no name. Use it only when you need to register endpoints first and attach them to a person afterwards, by sending the person's ID.

You haveUse
Names and endpoints togetherpeople.upsert, once.
Endpoints now, names laterpeople/endpoint/upsert now, then people.upsert when you have the names.
A change to one person's endpointspeople.upsert again for that person, with their full list of endpoints.

Before you start#

These calls are made as the customer's account, not as your parent account. Each account's people are its own.

When you created the account, the response gave you what you need to sign in to it:

ValueWhere it comes from
clientIdclientId in the create-account response.
apiKeyserviceUserApiKey in the create-account response.
usernameserviceUser

Exchange them for a bearer token with POST /authWithApiKey, exactly as described in Getting Started:

bash
curl -X POST "$BASE_URL/authWithApiKey" \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": 1234,
    "apiKey": "<serviceUserApiKey>",
    "username": "serviceUser"
  }'

Both calls on this page need the People.Update right, which the account's service user holds.

Send subscribers with their endpoints#

POST {{baseUrl}}/client/people.upsert

Creates each person if they are new and updates them if they already exist.

Request body#

The body is an object with one field, people, which is a list. Each person in the list has these fields:

FieldTypeRequiredDescription
fullNamestringYesThe person's name, as it should appear in Focus.
personTypestringYesstaff for a subscriber. external for a contact, someone outside the organisation who is not recorded.
thirdPartyIdstringNoYour own identifier for the person, for example their ID in your provisioning system. Send it every time. It is how Focus recognises the same person on later calls.
emailstringNoThe person's email address.
endpointsarrayNoThe person's endpoints. See How the endpoint list is applied.
endpoints[].typestringYesphone, email or teamsUserId.
endpoints[].endpointstringYesThe value: the phone number, the email address, or the Microsoft Teams user ID.
isActivebooleanNoSet to false for someone who has left.
retentionGroupIdintegerNoThe retention group to put the person in. Without it they use the account default.
idnumberNoThe Focus ID of an existing person, if you have stored it.

A request must not contain the same thirdPartyId twice, or the same email twice. If it does, the whole request is rejected.

Example#

bash
curl -X POST "$BASE_URL/client/people.upsert" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "people": [
      {
        "fullName": "Jane Smith",
        "personType": "staff",
        "thirdPartyId": "emp-00412",
        "email": "jane.smith@example-customer.com",
        "endpoints": [
          { "type": "phone", "endpoint": "447700900111" },
          { "type": "teamsUserId", "endpoint": "2c1f4a8e-7b3d-4e6a-9f10-5d2b8c7a6e41" }
        ]
      },
      {
        "fullName": "Sam Patel",
        "personType": "staff",
        "thirdPartyId": "emp-00413",
        "endpoints": [
          { "type": "phone", "endpoint": "447700900112" }
        ]
      }
    ]
  }'

Response#

The response lists every person in the request under either completed or failed.

json
{
  "completed": [
    {
      "id": 42,
      "fullName": "Jane Smith",
      "personType": "staff",
      "thirdPartyId": "emp-00412",
      "outcome": "inserted"
    }
  ],
  "failed": [
    {
      "person": { "fullName": "Sam Patel", "personType": "staff", "thirdPartyId": "emp-00413" },
      "reason": "<why this person was not saved>"
    }
  ]
}

The example is shortened. Each completed person comes back with the details Focus now holds for them.

FieldDescription
completed[].idThe person's Focus ID. Store it if you plan to use the endpoint-only call.
completed[].outcomeinserted for a new person, updated for a changed one, unchanged if nothing was different.
failed[].personThe person as you sent them.
failed[].reasonWhy they were not saved.

People are saved one by one, so some can succeed while others fail. Always check failed, even on a 200.

StatusWhen
200 OKAt least one person was saved.
400 Bad RequestNobody was saved, or the body was not valid.
401 UnauthorizedThe bearer token is missing or has expired.
403 ForbiddenThe caller does not hold People.Update.

How the endpoint list is applied#

The endpoints list is treated as the person's complete set of endpoints, not as additions.

What you sendWhat happens
A list of endpointsThe person ends up owning exactly those endpoints. Any endpoint they owned before that is not in the list is taken away from them.
An empty list, []The person loses all their endpoints.
No endpoints field at allThe person's endpoints are left exactly as they are.

So to add a second phone number to someone, send both numbers. To change only a person's name, leave endpoints out.

An endpoint that is taken away from a person is not deleted. It stays in the account with no owner.

Calling it again#

The call is safe to repeat. Send the same people again and they come back as unchanged.

Focus recognises an existing person by their id if you send it, otherwise by their thirdPartyId. This is why it is worth sending your own thirdPartyId from the start: you can then send your full list of people on every run, without first looking anyone up.

Endpoints that already have an owner affect how a person is matched:

  • If you send a person without an id, and their endpoints already belong to one existing person, Focus treats your entry as that existing person and updates them.

  • If you send a person with an id, and their endpoints belong to a different person, that entry fails.

  • If the endpoints you send for one person currently belong to two or more different people, that entry fails.

To move an endpoint from one person to another, take it off the old owner first, then add it to the new one.

Send endpoints on their own#

POST {{baseUrl}}/client/people/endpoint/upsert

Creates or updates endpoints without a name. The body is a list.

FieldTypeRequiredDescription
typestringYesphone, email or teamsUserId.
endpointstringYesThe value.
ownedByPersonIdintegerNoThe Focus ID of the person who owns the endpoint. This is completed[].id from people.upsert. Leave it out for an endpoint that has no owner yet.
isPrivatebooleanNoMarks the endpoint as private.
metadataobjectNoYour own reference data to store against the endpoint.
bash
curl -X POST "$BASE_URL/client/people/endpoint/upsert" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[
    { "type": "phone", "endpoint": "447700900113" },
    { "type": "phone", "endpoint": "447700900114", "ownedByPersonId": 42 }
  ]'

To give an unowned endpoint a name later, either send it again here with ownedByPersonId, or include it in the person's endpoints list in people.upsert.

Check what Focus holds#

To confirm what was saved, read it back with the search calls in the API reference:

For comparing Focus against your own system of record on a schedule, see People reconciliation.

Was this page helpful?