Getting Started

This guide walks you through a simple interaction with the Stenn Invoice Financing API in sandbox mode: Creating a company. For a complete view of the API objects, you can visit the API reference documentation.

If you want to start offering invoice financing in your platform immediately, visit the hosted invoice financing docs.

Step 1: Authentication

Start experimenting with Stenn APIs using the Sandbox mode which lets you test all our API endpoints without having to worry about creating any real transactions.

To begin you will need to obtain an access token to allow you to our API endpoints. Using your unique sandbox Client ID and Client secret server side key you can call the Authentication API endpoint. On success, an access token will be granted. Include this access token in the HTTP header in all your requests. See how authentication works to learn more.

curl --request POST \
  --url 'https://{base_url}/v1/auth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=client_credentials \
  --data client_id=YOUR_CLIENT_ID \
  --data client_secret=YOUR_CLIENT_SECRET

Step 2: Send your first API request

To create a company in Sandbox mode, run the following cURL command in your shell. Take note of the sandbox base URL used in the following example.

curl --request POST \
     --url https://{base_url}/invoice-financing/v1/companies \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <your_bearer_access_token>' \
     --header 'content-type: application/json' \
     --data '
{
  "name": "Pingan Holding Limited",
  "address": {
    "country_code": "CN",
    "city": "Shenzhen",
    "state": "Guangdong",
    "street": "G3M468 Futian District"
  },
  "website": "https://pingan.com.cn"
}

If everything worked, you should see the following response in your terminal with a different id and created timestamp.

{
  "id": "company_***",
  "object": "company",
  "name": "Pingan Holding Limited",
  "address": {
    "city": "Shenzhen",
    "country_code": "CN",
    "state": "Guangdong",
    "street": "G3M468 Futian District"
  },
  "website": "https://pingan.com.cn",
  "buyer_limit": null,
  "contacts": {
    "object": "list",
    "data": []
  },
  "created": "***"
}