This step assumes you have successfully created a new customer record and verified it using Customer Creationand Customer Verification steps of the guide
Now that you have created and verified a first customer record, you are able to onboard the customer on OffBlocks accounts. To do so, you need to use /customers/{customerId}/accountPOST request.
Create new customer account
post
/customers/{customerId}/accounts
Creates new account for the customer and generates a challenge to be signed in order to create a related blockchain account
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
customerIdstring · uuidRequired
Unique customer ID
Header parameters
SignaturestringRequired
HTTP message signature
Signature-InputstringRequired
HTTP message signature input
Idempotency-Keystring · uuidRequired
Idempotency key (UUID)
Content-DigeststringRequired
Content digest
Body
typestring · enumRequired
Type of the account
Possible values:
currenciesstring[]Required
Currencies of the account, at least one is required (ISO-4217)
Responses
201
Successful operation
application/json
400
Invalid request
401
Not authorised
404
Customer not found
500
Internal error
post
/customers/{customerId}/accounts
Let's say we want to open a new card account (the only option for the time being) that's using Euro as a base currency (we don't support multi-currency accounts just yet):
If everything was successful, you will receive a response with status 201 (Created) which looks similar to the following:
If everything went well, you will receive an account challenge to sign as a base64 encoded string. This is required to proceed to deployment stage. Signatures are not currently verified in our Sandbox environment, however they are still required to be submitted.
In order to submit a signed challenge, use a POST request to /accounts/{accountId}/challenge/sign endpoint.
Sign previously issued account challenge
post
/accounts/{accountId}/challenge/sign
Signs previously issued challenge to sign account creation or deletion transaction on-chain
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
accountIdstring · uuidRequired
Unique account ID
Header parameters
SignaturestringRequired
HTTP message signature
Signature-InputstringRequired
HTTP message signature input
Idempotency-Keystring · uuidRequired
Idempotency key (UUID)
Content-DigeststringRequired
Content digest
Body
Cryptographic signature generated using owner's EOA private key according to chain-specific algorithm. Signature is used for signing on-chain transactions such as creating a new account, authorising a recurring payment or setting up spending limits
ownerIdstringRequired
Unique signer account ID in a form of a valid on-chain address
Please, not that the signature also must be a base64 encoded string. If signature is verified, you will receive an empty response with status code 204 (No Content).
If, for any reason, the original challenge is lost or cannot be signed immediately, you can fetch it again using a dedicated endpoint. If we encounter an error during signature validation via /sign endpoint, a new challenge will be issued for you to retrieve.
Retrieve account challenge
get
/accounts/{accountId}/challenge
Retrieves challenge to sign account creation or deletion transaction on-chain. This operation invalidates any previously issued challenges for the account
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
accountIdstring · uuidRequired
Unique account ID
Header parameters
SignaturestringRequired
HTTP message signature
Signature-InputstringRequired
HTTP message signature input
Responses
200
Successful operation
application/json
400
Invalid request
401
Not authorised
404
Account not found
500
Internal error
get
/accounts/{accountId}/challenge
Once the challenge has been successfully signed, we will proceed to deployment stage. The account will be automatically deployed and activated, which you can verify by making a GET request to /accounts/{accountId}.
Retrieve account
get
/accounts/{accountId}
Retrieves account's details
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
accountIdstring · uuidRequired
Unique account ID
Header parameters
SignaturestringRequired
HTTP message signature
Signature-InputstringRequired
HTTP message signature input
Responses
200
Successful operation
application/json
400
Invalid request
401
Not authorised
404
Account not found
500
Internal error
get
/accounts/{accountId}
From there we can proceed to issuing cards for the account.
GET /v1/accounts/{accountId}/challenge HTTP/1.1
Host: api.offblocks.xyz
Authorization: Bearer YOUR_SECRET_TOKEN
Signature: text
Signature-Input: text
Accept: */*
GET /v1/accounts/{accountId} HTTP/1.1
Host: api.offblocks.xyz
Authorization: Bearer YOUR_SECRET_TOKEN
Signature: text
Signature-Input: text
Accept: */*