Skip to main content
Create a counterparty and verify its saved address, with optional synthetic bank and document records.

Prerequisites

  • A workspace API key, exported as RANGE_API_KEY. Use the shared quickstart for key setup and Bearer authentication.
  • Permission to create synthetic records in the workspace selected by your key.

1. Look for existing names

Run this setup once to create the API client and generate a unique name and synthetic address, following the Platform test inputs. It uses httpx.
Search for the generated name using GET /v2/counterparties.
Example response (HTTP 200), abbreviated where fields are omitted:
search matches a case-insensitive substring of the name. Review candidates before creating a record. This lookup does not reserve a name or prevent duplicates; creation separately enforces workspace name uniqueness. A null meta.next_cursor ends pagination.

2. Create the counterparty

Create the counterparty with the generated name using POST /v2/counterparties.
Example response, abbreviated where fields are omitted:
Keep id as counterparty_id for every subsequent request. Use the IDs returned by your own requests throughout this guide. Creating the same name again returns HTTP 409, as the example request body and error response below show. You do not need to send a duplicate, and the complete script does not.
Example error response:

3. Add an address

Attach the synthetic address from step 1 on the ethereum network using PUT /v2/counterparties/{id}/addresses.
Example response (HTTP 200), abbreviated where fields are omitted:

4. Read back the address

Read the saved counterparty using GET /v2/counterparties/{id} and check for the address you just added.
Example response (HTTP 200), abbreviated where fields are omitted:
The onboarding check is complete when the detail response contains the returned address ID and your submitted address.

5. Optionally add a synthetic bank record

Add a synthetic CAD bank record using PUT /v2/counterparties/{id}/bank-accounts.
Use only fake bank and account names without bank identifiers.
Example response (HTTP 200), abbreviated where fields are omitted:

6. Read back the bank record

Read the counterparty again using GET /v2/counterparties/{id} and check for the saved CAD bank record.
Example response (HTTP 200), abbreviated where fields are omitted:
Skip steps 5 and 6 together if you do not need bank data.

Prepare a sample document

Before step 7, define a helper that builds a tiny generated PDF in memory:

7. Optionally upload the document

Upload the generated PDF using POST /v2/counterparties/{id}/documents to attach it to the counterparty.
Uploads accept PDF, CSV or plain text up to 10 MB; the upload type accepts kyc, kyb, contract, other, narrative, or statement.
Example response (HTTP 201), abbreviated where fields are omitted:

8. Read back the document metadata

Read the counterparty using GET /v2/counterparties/{id} and check for the uploaded document’s ID and MIME type.
Example response (HTTP 200), abbreviated where fields are omitted:
Skip steps 7 and 8 together if you do not need a document.

Complete runnable script

Save as onboard_counterparty.py. Set RANGE_API_KEY as in the shared quickstart, then run python onboard_counterparty.py; add --with-bank --with-document to exercise both optional branches. The script verifies the synthetic data, then removes its own children and counterparty. The step-by-step requests above keep the record until you delete it.
Cleanup references: remove a document and delete the counterparty. For failed requests, use Errors and rate limits.
Last modified on November 30, 2026