Getting Started with the API

Who is this for?

These steps are for developers who are going to use the API features of Canopy.

What will you learn on this page?

How Canopy authenticates users, generates tokens, and how to use them.

After you've successfully authenticated with our API. You can view our API Reference to learn more.

Getting your API keys from Canopy OS

  1. Go to Canopy OS to generate new App keys.
  2. Copy down the CLIENT_ID and CLIENT_SECRET you'll use these to get a token from the API

Use your API keys to get an auth token

Canopy uses an OAuth2 flow to grant temporary auth tokens that you can use for your application.

  1. Use the POST /auth/tokenendpoint to get an auth token.
  2. curl -s -x POST "https://${CANOPY_HOST}/auth/token" \
      --header 'content-type: application/json' \
      --data-raw '{
        "client_id": "${CLIENT_ID}",
        "client_secret": "${CLIENT_SECRET}"
    }'
    
  3. Inspect the response and use the bearer token to make a request to the API:
  4. {
        "access_token": "eyJraWQi......x_IA",
        "expires_in": 22899,
        "token_type": "Bearer"
    }
    

Test your auth token with an example query

Remember to use the token from /auth/token in your HTTP HEADER with the BEARER prefix.

curl -s \
  --location 'https://qa-api.us.canopyservicing.com/api_users' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer eyJraWQi...x_IA'

You'll see a response with HTTP 200 that looks similar to the snippet below.

[
  {
    "api_user_id": "1001",
    "first_name": "Qualis",
    "last_name": "Maximam",
    "email": "[email protected]",
    "phone": "1-555-555-1234",
    "role": "Lender",
    "status": "Invite Sent",
    "token": ""
  },
  ...
]