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

Prerequisites

  • A workspace API key set up with the shared quickstart, passed as a Bearer token in RANGE_API_KEY.
  • Python with httpx installed: python -m pip install httpx.
  • Permission to create synthetic records in the workspace selected by your key. These calls use the /v2 Platform endpoints.
Use the Platform test inputs. Generate a unique docs-test- name and synthetic address on each run; use only fake CAD bank names without bank identifiers and the tiny generated PDF below. Uploads accept PDF, CSV or plain text up to 10 MB; the upload type accepts kyc, kyb, contract, other, narrative, or statement. The recorded IDs are examples from a completed run; always use the IDs returned by your own requests. Run this setup once before the numbered steps:

1. Look for existing names

Endpoint reference.
Recorded 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. The synthetic name returned an empty first page in the recorded run.

2. Create the counterparty

Endpoint reference.
Recorded response, abbreviated where fields are omitted:
Keep id as counterparty_id for every subsequent request. Creating the same name again returns HTTP 409. The following POST body and rejection are recorded examples only, from a separate synthetic duplicate-name check. No duplicate request is needed for this procedure or included in the complete script.
Recorded rejection:

3. Add an address

Endpoint reference.
Recorded response (HTTP 200), abbreviated where fields are omitted:

4. Read back the address

Endpoint reference.
Recorded 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

Endpoint reference.
Recorded response (HTTP 200), abbreviated where fields are omitted:

6. Read back the bank record

Endpoint reference.
Recorded response (HTTP 200), abbreviated where fields are omitted:
Skip steps 5 and 6 together if you do not need bank data.

Document fixture

Define the tiny in-memory PDF before step 7:

7. Optionally upload the document

Endpoint reference.
Recorded response (HTTP 201), abbreviated where fields are omitted:

8. Read back the document metadata

Endpoint reference.
Recorded 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 10, 2026