Skip to main content
Version: 3.0

Trade Account API V3 (preview)

Download this API's OpenAPI YAML

This API is currently in preview. This API allows you to onboard your business customers to your own product and to the Two "Buy Now Pay Later" product.

Specifically:

  • Enable 1-click checkout with Two
  • Approve additional users to place orders on behalf of your business customers
  • Access insights and enriched data on your business customers

Authentication & IDs​

Trade Account API v3 supports flexible identification of resources, allowing you to use either your own internal identifiers or our system-generated identifiers in path segments.

How it works:​

When you provide an ID in a path parameter (e.g., cid in /customer/cid), our system attempts to resolve it:

If the ID begins with two_: We interpret this as an identifier generated by our system. You would typically use this when referencing resources that you've previously created or retrieved from our API.

Example: GET /trade-account/v3/customer/two_XYZ789 If the ID does NOT begin with two_: We interpret this as your own internal identifier for the resource. This allows you to integrate seamlessly with your existing data structures.

Example: GET /trade-account/v3/customer/yourInternalID123

Collision Avoidance:​

To ensure unambiguous resolution, it is CRITICAL that any customer or entity identifiers you use and pass directly to our API (i.e., those without the two_ prefix) DO NOT begin with the string two_. This prefix is strictly reserved for identifiers originating from our platform. Please ensure your internal ID generation logic adheres to this constraint.

Getting Started​

Step 1: Create a B2B trade account customer​

  • Create a new trade account customer using the POST /trade-account/v3/customer endpoint.

Step 2: Create users for your trade account customers.​

  • The employees who place orders on behalf of your trade account customer (their employer), can be set up for purchasing through POST /trade-account/v3/customer/<cid>/user.

  • Upon successfully creating a user for a customer, onboarding is completed. To verify the user generate the verification link using POST /trade-account/v3/user/<uid>/verification/url. Verification of the customer user will allow one-click purchases for the customer user.

Note: Two reserves the right to add extra verification steps for certain orders.

Environments​

Testing​

https://api.sandbox.two.inc

Note: Read about our sandbox environment specific behaviour.

Production​

https://api.two.inc

Authentication​

For instructions on how to obtain API keys, visit this page. You will obtain two different keys, an initial one for testing in our sandbox environment and once ready, for production. Your API keys enables others to act on your behalf if they are able to obtain them, so make sure to keep them safe. Your API key is not to be shared with anyone, including in your version control system, client-side code, in public chatrooms and so on. The API key is applied in the request header. For example:

GET /something
X-Api-Key: secret_test_aabbccddeeff0123456789

API Keys have the following structure: secret_<env>_<key> where:

  • env is determined by the environment (prod for production, test for test environments)
  • key is a random, URL-safe, 64-bit encoded text string containing 32 random bytes.

Security Scheme Type:

apiKey

Header parameter name:

X-Api-Key