Redeeming Partner Access Tokens
Prerequisites
Before you can start using the dMRV Connect as a Partner, you need to obtain an access token. This is a two-step process:
- Supplier grants access - The supplier generates an authorization code in the MyPuro portal
- Partner redeems the code - The Partner exchanges the authorization code for an access token using their Partner Client Secret
Step 1: Supplier Grants Access
The Supplier starts by sharing access to their organization in the MyPuro portal:
- Supplier logins to the MyPuro portal (e.g., https://portal.puro.earth)
- Navigate to Settings > API Access
- Click "+ Add Partner Access"
- Fill out the form and click "Add"
- Save the generated authorization code - it will not be shown again
- Shares this code securely with the Partner
If the authorization code is not redeemed within 3 days, the code will expire and the supplier will need to generate a new one.
Step 2: Partner Redeems Authorization Code
Once you receive the authorization code from the Supplier, you can exchange it for an access token.
For this you need:
- Partner Client Secret (
pcs_...) - provided directly by Puro.earth - Authorization Code - provided by the Supplier in Step 1
Creating an Access Token
Use the POST /v0/partners/auth/access-tokens endpoint to redeem your authorization code:
For this endpoint, use your Partner Client Secret (pcs_...) as the Bearer token.
curl -X 'POST' "/v0/partners/auth/access-tokens" \
-H "Accept: application/json" \
-H "Authorization: Bearer $BEARER" \
-d '{ \
"authorizationCode": "auth_code_from_supplier" \
}'
Response
The response will contain your access token:
{
"accessToken": "poa_abc123xyz..."
}
The access token will only be shown once. Save it securely as you'll need it for all subsequent API calls. If you lose it, you'll need to request a new authorization code from the supplier.
Managing Access
Suppliers can manage the Partner's access at any time from the MyPuro portal:
- Revoke access completely.
- Change facility access to grant or remove access to specific facilities.
As a Partner:
- If the Supplier revokes your access, your access token will stop working immediately.
- If there is a change in access grants, the facilities will disappear or appear in the API responses.
Next Steps
Now that you have an access token, please move on to the next page to test it out. The next step is to fetch the facilities you have access to, and start creating a monitoring period.