When to create a buyer
Create a buyer and key once per user, the first time they need one: when they sign up, or when they first ask your agent to buy something. Reuse both after that.Create the buyer
Use your own ID for the user asexternalId. It links the Sapiom buyer to your user, so the same person never gets two buyers.
id with your user record. The next examples call it BUYER_ID.
If the buyer already exists
409 Conflict means a buyer with that externalId already exists, for example after a retry. Look it up instead of creating another:
Create and store the buyer key
plainKey, shown only once. Store it encrypted with your user record and reuse it for every session with that user. Your backend passes it to your agent and browser worker for that session. See Connect your agent.
Remove a buyer
To remove a buyer, for example when a user closes their account, callDELETE /v1/tenants/{BUYER_ID} with your platform key.