v3

User identifiers

Act for your own customers without holding their password, and without asking them to log in twice.

A user identifier is your own id for one of your customers, linked once to their BTC Direct account. After that, sending it authenticates the call as that customer — every customer-scoped endpoint accepts it in place of their session:

User-Identifier: your-own-id-for-this-customer

That is the whole point, and the whole risk. It is a delegation credential, not a label: with it you act as that person, and nothing prompts them each time. Treat it as you would a password.

Linking one, once

The link is the customer's decision, taken while they are signed in. You can never attach an identifier to an account you name in a request.

YouBTC DirectCustomer
  1. Register your id

    You

    Your own value, for a customer who may not have an account with us yet. You get back a link to send them to. Registering the same value twice is safe and returns the same registration.

    POST /api/v3/users/identifiers
  2. They open the link

    Customer

    They sign in, or register if they are new. Either way they end up signed in and holding a session.

  3. They accept the link

    Customer

    Their session completes it — that call carries no account, so it can only ever attach to whoever is signed in.

    POST /api/v3/users/me/identifiers
  4. We tell you

    BTC Direct

    A webhook confirms the link. From here the identifier authenticates as that customer.

    user_identifier_linked

An identifier that is never linked is discarded after 24 hours, so an abandoned flow does not hold your value forever.

On a checkout

Name your customer when you create a checkout or a sell onboarding: identifier in the body, or the User-Identifier header once it is linked. Both at once must be the same value, or the call is refused (identifier_mismatch). Only your server sets one: a call that names an identifier needs a partner access token, never the public api-key (server_credential_required).

What the customer then sees depends on the identifier and on the browser:

  • Linked, not signed in: the page signs them in straight away. The url carries a one-time login for exactly that customer, valid for 15 minutes and spent on first use; an expired or spent one simply shows the sign-in screen.
  • Linked, signed in as that customer: they carry on. No sign-in, no connect step.
  • Signed in as someone else: the page stops with an error. It never switches accounts and never links your identifier to the wrong person.
  • Not linked yet: they register or sign in. Registering links it at once; signing in asks them once to connect. Either way you receive user_identifier_linked.

A customer may decline the connect step. A buy or a sell then carries on without the link and the next checkout asks again; a sell onboarding sends them back to your returnUrl. A sell onboarding requires an identifier, since linking it is what it is for.

One identifier per customer: linking a new one of yours to an account replaces the one that account held for you before. Identifiers you hold at other partners are unaffected, and an identifier never moves to another account.

Through the API, never through a URL

An identifier must not travel in a query string

Register and send identifiers on API calls, server to server. They are credentials: in a URL they land in the address bar, in browser history, in the referrer of every asset the page loads, and in any proxy log on the way.

Where a link has to carry one, it carries an opaque handle we mint for it instead of your value — that is what the url from POST /api/v3/checkouts does. A handle is safe to lose; a delegation credential is not.

Choosing your values

Stable for the life of the relationship, and not guessable from outside. An internal uuid is right. An email address or an incrementing customer number is not: the first changes, and the second lets anyone who has one guess the next.