Skip to main content

Overview

The POST /v1/accounts endpoint accepts the full account onboarding graph in a single request. All children (addresses, contacts, payment methods, tags) are written in one database transaction. Any child failure rolls back the parent account and every already-inserted child — you get a complete record or nothing. The 201 response includes all children hydrated inline; no follow-up GET calls are needed.

Minimal create

Only name and account_type are required.

Full B2B onboarding graph

One POST creates the account, 3 addresses, 2 contacts, a payment method, and 2 tags.
Expected 201 response (truncated):

Address field aliases

The endpoint accepts Stripe-style field names as aliases for the internal column names: Both sets of names are accepted; canonical names (line1, state, zip) are returned in all responses.

Default billing and shipping flags

  • Exactly one billing address may have is_default_billing: true.
  • Exactly one shipping address may have is_default_shipping: true.
  • If no address explicitly sets the flag, the first address of each type is auto-defaulted.
  • Sending more than one is_default_billing: true (or is_default_shipping: true) returns 422.

Contact role vs title

The role field in the API payload is stored internally as title. Both field names are accepted in the request body; title is returned in responses.

Payment methods: test mode

In test mode, use Stripe test card tokens:
  • pm_card_visa — Visa, succeeds
  • pm_card_mastercard — Mastercard, succeeds
  • pm_card_visa_chargeDeclined — always fails
Stripe must be configured for your entity. If Stripe is not configured, payment_methods[] will return an error; omit the array if you are testing without Stripe.

Credit limit

credit_limit is a JS number (float) in the response, never a Postgres NUMERIC string. credit_balance on a new account equals credit_limit (no outstanding AR yet).

Tags: auto-create

Tags supplied by name are auto-created for the entity if they do not exist. The name is slugified (lowercased, non-alphanumeric chars replaced by _) to form the slug. Applying the same tag name twice in tags[] is idempotent.

Error envelope

All errors follow the canonical envelope:
Common validation errors:

Idempotency

Supply Idempotency-Key: <unique-string> to safely retry creates without duplicating records. The key is honored for 24 hours.
  • GET /v1/accounts/:id?expand[]=addresses,contacts — retrieve with children expanded
  • POST /v1/accounts/:id/addresses — add an address to an existing account
  • POST /v1/accounts/:id/contacts — add a contact to an existing account
  • POST /v1/accounts/:id/payment-methods — attach a payment method to an existing account
  • POST /v1/accounts/:id/merge — merge two accounts