Delegated API client integration
This guide walks through the authentication flow for a delegated API clientDelegated API clientAn API client type used with [Delegation of Authority](/apis/authentication/delegation-overview/) that authenticates with a client assertion (a JWT signed with a private key whose X.509 certificate is registered with Weavr) instead of end-user credentials. It receives access tokens scoped to a specific identity user and can perform operations server-to-server without triggering Strong Customer Authentication step-up., from retrieving identity IDs to executing operations with a delegated access token.
Before following this guide, complete the pre-integration setup described in the Delegation of Authority overview.
Authentication flow
1. Retrieve identity IDs
Your backend needs the identity ID of the user on whose behalf it will operate. You can retrieve the list of identities associated with your program using the following endpoint:
/identities Open API reference /identities{ "offset": 0, "limit": 0}Store the identity IDs in your backend system. You use these when requesting delegated access tokens.
2. Generate a client assertion
Create a signed JWT (JSON Web Token) that serves as your client assertion. This JWT proves that the request comes from your delegated API clientDelegated API clientAn API client type used with [Delegation of Authority](/apis/authentication/delegation-overview/) that authenticates with a client assertion (a JWT signed with a private key whose X.509 certificate is registered with Weavr) instead of end-user credentials. It receives access tokens scoped to a specific identity user and can perform operations server-to-server without triggering Strong Customer Authentication step-up.. The identity user your backend wants to act on behalf of goes in the token request body, not in the JWT.
The JWT must be signed using the RS256 algorithm with the private key whose certificate you uploaded for your delegated API clientDelegated API clientAn API client type used with [Delegation of Authority](/apis/authentication/delegation-overview/) that authenticates with a client assertion (a JWT signed with a private key whose X.509 certificate is registered with Weavr) instead of end-user credentials. It receives access tokens scoped to a specific identity user and can perform operations server-to-server without triggering Strong Customer Authentication step-up. during setup.
sub is your API client IDPut your API client ID in sub, as a string. Weavr IDs are longer than JavaScript can hold exactly as numbers, so a numeric sub can lose its last digits and no longer match your API client.
JWT header
{
"alg": "RS256",
"typ": "JWT"
}
JWT payload
{
"sub": "${API_CLIENT_ID}",
"iss": "${API_CLIENT_ID}",
"iat": 1700000000,
"exp": 1700000300,
"jti": "unique-request-id-12345"
}
| Field | Description |
|---|---|
sub | Your delegated API clientDelegated API clientAn API client type used with [Delegation of Authority](/apis/authentication/delegation-overview/) that authenticates with a client assertion (a JWT signed with a private key whose X.509 certificate is registered with Weavr) instead of end-user credentials. It receives access tokens scoped to a specific identity user and can perform operations server-to-server without triggering Strong Customer Authentication step-up. ID, obtained from the Embedder PortalEmbedder PortalA web-based portal where embedders manage their Weavr account: browse customers and instruments, configure programmes, find API credentials and profile IDs, run Sandbox simulations, and inspect webhook deliveries. Sandbox and Live are separate, with their own credentials and data., as a string. Required. |
iss | Your delegated API clientDelegated API clientAn API client type used with [Delegation of Authority](/apis/authentication/delegation-overview/) that authenticates with a client assertion (a JWT signed with a private key whose X.509 certificate is registered with Weavr) instead of end-user credentials. It receives access tokens scoped to a specific identity user and can perform operations server-to-server without triggering Strong Customer Authentication step-up. ID again. Recommended. |
iat | Issued-at timestamp (Unix epoch in seconds). |
exp | Expiration timestamp (Unix epoch in seconds). Keep the validity window short, for example 5 minutes. |
jti | A unique identifier for this assertion, such as a UUID. |
Keep the JWT validity window as short as practical. A window of 5 minutes or less is recommended. Each jti value must be unique across requests.
3. Obtain a delegated access token
Send the client assertion to our token endpoint to receive a delegated access token. Use the API key of the same programmeProgrammeA programme represents your application within Weavr. Everything you create - customers, instruments, and transactions - sits beneath a programme. When you register as an Embedder, you receive a programme in the Sandbox and, once approved, one in Live. A programme is not a Workspace: a workspace is your company's account, and it can hold several programmes. as your delegated API clientDelegated API clientAn API client type used with [Delegation of Authority](/apis/authentication/delegation-overview/) that authenticates with a client assertion (a JWT signed with a private key whose X.509 certificate is registered with Weavr) instead of end-user credentials. It receives access tokens scoped to a specific identity user and can perform operations server-to-server without triggering Strong Customer Authentication step-up..
/access_token Open API reference /access_token{ "identity": { "type": "CONSUMER", "id": "123456789" }, "clientAssertion": "string", "token": "string"}Include the target identity and the client assertion in the request body:
{
"identity": {
"type": "${IDENTITY_TYPE}",
"id": "${IDENTITY_ID}"
},
"clientAssertion": "${CLIENT_ASSERTION}"
}
The response contains a delegated access token, in token, scoped to the identity in the request body.
Delegated access tokens have a limited lifetime. When a token expires, generate a new client assertion and call this endpoint again to obtain a fresh token; there is no refresh endpoint. Cache the token in your backend and re-request before it expires to avoid unnecessary calls.
The delegated access token is pre-authorized-no SCASCA (Strong Customer Authentication). Strong Customer Authentication - a two-factor authentication solution required by PSD2 regulations for when end-users are accessing their payment account sensitive information or initiating transactions. SCA requires at least two of the following: something you know (password), something you have (device), or something you are (biometrics). step-up is required. Operations performed with this token bypass the standard step-up authentication flow.
4. Execute operations
Use the delegated access token in the Authorization header of your API requests, just as you would with a standard user access token. Include your API key in the api-key header as usual.
Authorization: Bearer ${DELEGATED_ACCESS_TOKEN}
api-key: ${YOUR_API_KEY}
Token request errors
| Response | Cause | Fix |
|---|---|---|
400 Invalid assertion. Expected a valid JWT | clientAssertion isn't a well-formed signed JWT | Check the JWT has three Base64URL parts and the claims described in this guide |
400 Invalid assertion subject | sub isn't an API client ID, for example it holds an identity ID or a name | Put your API client ID in sub |
400 Invalid assertion - no matching certificate registered | No active certificate on that API client verifies the signature: no certificate uploaded to this client, signed with a different private key, unsupported alg, or the certificate has expired | Upload the certificate to this client and sign with the matching private key. See Generate and upload a certificate |
403 INSUFFICIENT_PERMISSIONS | The assertion is valid, but the request doesn't line up: delegation isn't enabled for the programmeProgrammeA programme represents your application within Weavr. Everything you create - customers, instruments, and transactions - sits beneath a programme. When you register as an Embedder, you receive a programme in the Sandbox and, once approved, one in Live. A programme is not a Workspace: a workspace is your company's account, and it can hold several programmes., or the API key, API client, and identity are from different programmesProgrammeA programme represents your application within Weavr. Everything you create - customers, instruments, and transactions - sits beneath a programme. When you register as an Embedder, you receive a programme in the Sandbox and, once approved, one in Live. A programme is not a Workspace: a workspace is your company's account, and it can hold several programmes. | Use the API key of the programmeProgrammeA programme represents your application within Weavr. Everything you create - customers, instruments, and transactions - sits beneath a programme. When you register as an Embedder, you receive a programme in the Sandbox and, once approved, one in Live. A programme is not a Workspace: a workspace is your company's account, and it can hold several programmes. the API client belongs to, and check with our support team that delegation is enabled for that programmeProgrammeA programme represents your application within Weavr. Everything you create - customers, instruments, and transactions - sits beneath a programme. When you register as an Embedder, you receive a programme in the Sandbox and, once approved, one in Live. A programme is not a Workspace: a workspace is your company's account, and it can hold several programmes. |
Available operations
The following endpoints are accessible using a delegated access token. Some endpoints have specific requirements when called via delegation-check the notes column for details.
Managed cards
| Endpoint | Description | Notes |
|---|---|---|
POST /managed_cards | Create a managed cardManaged CardA payment card (virtual or physical) that can be created and managed through the Weavr platform. Cards can operate in prepaid mode (with their own balance) or debit mode (linked to a managed account). All cards must be assigned to a card assignee who is an Authorised User. | userId is required in the request body to specify the card ownerCard OwnerThe individual or business entity that owns the cards and the funds available to be spent via card purchases. Before cards can be issued, the card owner must be onboarded on Weavr, including completing a KYB process for business card owners or a KYC process for individual card owners.. |
GET /managed_cards | List managed cardsManaged CardA payment card (virtual or physical) that can be created and managed through the Weavr platform. Cards can operate in prepaid mode (with their own balance) or debit mode (linked to a managed account). All cards must be assigned to a card assignee who is an Authorised User. | |
GET /managed_cards/${ID} | Get card details | |
PATCH /managed_cards/${ID} | Update a managed cardManaged CardA payment card (virtual or physical) that can be created and managed through the Weavr platform. Cards can operate in prepaid mode (with their own balance) or debit mode (linked to a managed account). All cards must be assigned to a card assignee who is an Authorised User. | |
POST /managed_cards/${ID}/block | Block a card | |
POST /managed_cards/${ID}/unblock | Unblock a card | |
DELETE /managed_cards/${ID}/destroy | Destroy a card | |
POST /managed_cards/${ID}/physical | Upgrade to physical cardPhysical CardA payment card that is printed or embedded in wearables and sent to customers directly. Physical cards are created by first creating a virtual card and then upgrading it to a physical card. They are sent in an inactive state and must be activated by the card assignee before first use. | |
POST /managed_cards/${ID}/physical/activate | Activate physical cardPhysical CardA payment card that is printed or embedded in wearables and sent to customers directly. Physical cards are created by first creating a virtual card and then upgrading it to a physical card. They are sent in an inactive state and must be activated by the card assignee before first use. |
Managed accounts
| Endpoint | Description | Notes |
|---|---|---|
POST /managed_accounts | Create a managed accountManaged AccountAn account held at a financial institution that can be created and managed through the Weavr platform. Each account has a balance where customers can hold funds. Optionally, an IBAN can be assigned to enable wire transfers to bank accounts outside of Weavr. | |
GET /managed_accounts | List managed accountsManaged AccountAn account held at a financial institution that can be created and managed through the Weavr platform. Each account has a balance where customers can hold funds. Optionally, an IBAN can be assigned to enable wire transfers to bank accounts outside of Weavr. | |
GET /managed_accounts/${ID} | Get account details | |
GET /managed_accounts/${ID}/statement | Get account statement |
Transfers
| Endpoint | Description | Notes |
|---|---|---|
POST /transfers | Create a transfer | |
GET /transfers | List transfers | |
GET /transfers/${ID} | Get transfer details |
Sends
| Endpoint | Description | Notes |
|---|---|---|
POST /sends | Create a send | |
GET /sends | List sends | |
GET /sends/${ID} | Get send details |
Outgoing wire transfers
| Endpoint | Description | Notes |
|---|---|---|
POST /outgoing_wire_transfers | Create an outgoing wire transferWire TransferA transaction that moves funds between accounts. An incoming wire transfer moves funds from a third-party bank account to a Weavr managed account, while an outgoing wire transfer moves funds from a Weavr managed account to a third-party bank account. Wire transfers require the managed account to have an assigned IBAN (for EUR) or sort code and account number (for GBP). | |
GET /outgoing_wire_transfers | List outgoing wire transfersWire TransferA transaction that moves funds between accounts. An incoming wire transfer moves funds from a third-party bank account to a Weavr managed account, while an outgoing wire transfer moves funds from a Weavr managed account to a third-party bank account. Wire transfers require the managed account to have an assigned IBAN (for EUR) or sort code and account number (for GBP). | |
GET /outgoing_wire_transfers/${ID} | Get OWTOWT (Outgoing Wire Transfer). Outgoing Wire Transfer - a transaction that moves funds from a Weavr managed account to a bank account held at a third-party financial institution. OWTs require the managed account to have an assigned IBAN and the user to complete Strong Customer Authentication. details |
Transactions initiated via a delegated access token are not subject to SCASCA (Strong Customer Authentication). Strong Customer Authentication - a two-factor authentication solution required by PSD2 regulations for when end-users are accessing their payment account sensitive information or initiating transactions. SCA requires at least two of the following: something you know (password), something you have (device), or something you are (biometrics). challenges. They proceed directly to execution without requiring user confirmation.
Rate limiting
Since delegated API clientDelegated API clientAn API client type used with [Delegation of Authority](/apis/authentication/delegation-overview/) that authenticates with a client assertion (a JWT signed with a private key whose X.509 certificate is registered with Weavr) instead of end-user credentials. It receives access tokens scoped to a specific identity user and can perform operations server-to-server without triggering Strong Customer Authentication step-up. operations are not gated by SCASCA (Strong Customer Authentication). Strong Customer Authentication - a two-factor authentication solution required by PSD2 regulations for when end-users are accessing their payment account sensitive information or initiating transactions. SCA requires at least two of the following: something you know (password), something you have (device), or something you are (biometrics). challenges, there is no natural throttle on the rate of requests. To avoid performance degradation:
- Implement rate limiting in your backend to control the volume of delegated API calls.
- Space out bulk operationsBulk OperationsThe capability of grouping multiple individual API-based actions into a batch. Bulk operations allow you to execute hundreds or thousands of operations by making only one or two API calls, increasing throughput, accomplishing actions in a secure session, and reducing complexity in your application. rather than sending large bursts of requests simultaneously.
- Monitor API response times and back off if you observe increased latency or error rates.
Refer to Rate limiting for the general rate limit policies that apply to all API clients.
End-user experience changes
When Delegation of Authority is turned on for your program, end users see an additional consent screen during onboarding. The screen informs the user that your platform may perform certain financial operations on their behalf.
The consent screen appears during corporate (KYBKYB (Know Your Business). Know Your Business - the identity verification process for corporate customers. This process allows you to securely verify your business customer's identity. Weavr asks users to submit the information and documentation they need for approval by financial providers.) onboarding for corporatesCorporates (Corporate Identity). Business entities that can be onboarded as customers on Weavr. Corporate customers represent companies and require Know Your Business (KYB) verification. They can have multiple authorised users and issue cards to card assignees.. Contact your account manager for the equivalent behaviour in consumer (KYCKYC (Know Your Customer). Know Your Customer - the identity verification process for consumer customers. This process allows you to securely verify your user's identity. Weavr asks users to submit the information and documentation they need for approval by financial providers.) flows if your programmeProgrammeA programme represents your application within Weavr. Everything you create - customers, instruments, and transactions - sits beneath a programme. When you register as an Embedder, you receive a programme in the Sandbox and, once approved, one in Live. A programme is not a Workspace: a workspace is your company's account, and it can hold several programmes. supports consumersConsumers (Consumer). Individual people who can be onboarded as customers on Weavr. Consumer customers require Know Your Customer (KYC) verification. For consumers, the card owner and card assignee are typically the same person..
The consent is collected once during onboarding and does not need to be renewed for each delegated operation.