X-SP-End-User.
What a service account reaches
- Only its own project. A call to an agent in another project returns
404. - Only public agents. A service account never reaches a private agent, whatever its role. Every agent it creates is public.
- Only its own threads. With
X-SP-End-User, it reads only the threads that end user created. Without the header, it reads only the threads the service account created itself.
Create a service account and its key
A Project admin or Org admin creates a service account and its first key in one step, in the Priors app:- Open the project’s API keys page and choose Create key.
- Name the key and pick how long it lasts: 90 or 365 days, 365 by default. A service-account key always expires.
- Tick Mark as service account key, and pick the service account’s role. See the table below.
- Choose Generate key, and copy the key. The secret is shown once. Put it straight into your secret manager.
spk_<key_id>_<secret>. Note its expiry date when you store it: an expired key returns 401 with no advance warning to your code.
The roles mean the same as for a person. See Roles and permissions. A service account cannot make an agent private or change an agent’s visibility.
Check the key with GET
/v2/me. For a service account, api_key.acts_as.type is service_account.
Rotate a key
- Create a new service-account key with the same role, as above. In the Priors app, each new service-account key comes with its own service account.
- Deploy the new key to every server.
- Revoke the old key on the API keys page. Revocation applies on the next request.
X-SP-End-User stay reachable with the new key. Threads that the old service account created without the header stay with the old service account.
Act for one of your customers
Send your own stable id for the customer inX-SP-End-User on every call made for that customer:
400. See Authentication.