Puro.earth Sales Channel Services (2.9.1-alpha.2)
Download OpenAPI specification:Download
The Sales Channel Services API uses role-based access control (RBAC) to assign and manage rights for users. If a request is made by a user who lacks the needed authorization, the request will instead return either an HTTP 403 Forbidden or HTTP 404 Not Found response.
Not Found responses are reserved for cases where the application cannot determine whether the resource exists or whether the user is not able to interact with it. In endpoints that list multiple resources, only those the user is authorized to view will be returned.
List API keys of the current user
Lists information on all API keys attached to the current user.
This can be used to discover unused API keys and delete those which are not in use anymore. It is strongly recommended to delete all such unused API keys, as they are sensitive secrets which are a security liability when left around lingering.
Authorizations:
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
[- {
- "id": "cl0s639m50000q6xd99vv2gqs",
- "createdOn": "2000-01-01T00:00:00.000Z",
- "expiresAt": "2000-01-01T00:00:00.000Z"
}
]
Create an API key for the current user
Creates a new API key for the current user. The API key will have the same rights as the user who created it.
The API key can be used to authenticate using basic-auth, where the username is the API token ID and the password is the API token passphrase.
Please store the API id-passphrase combination somewhere secure, as you will not be able to recover the passphrase.
Authorizations:
Responses
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "id": "cl0s639m50000q6xd99vv2gqs",
- "createdOn": "2000-01-01T00:00:00.000Z",
- "expiresAt": "2000-01-01T00:00:00.000Z",
- "passphrase": "aad75005-ed0e-4a29-934a-9cd99bccf7bc"
}
Get the sales channel binding of a user
Authorizations:
path Parameters
userId required | string The ID of the user to fetch the saleschannel roles for. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "userId": "cl6aq4et20000mcxd38uh9w24",
- "salesChannelId": "cl6aq6sxp0004snxd516by16w",
- "roles": [
- "TRADERONBOARDERPROPOSAL_VIEWER"
]
}
Bind a user to a sales channel
Authorizations:
path Parameters
userId required | string The ID of the user to create the binding for. |
salesChannelId required | string The sales channel to bind the user to |
Responses
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "userId": "cl6aq4et20000mcxd38uh9w24",
- "salesChannelId": "cl6aq6sxp0004snxd516by16w",
- "roles": [
- "TRADERONBOARDERPROPOSAL_VIEWER"
]
}
Unbind a user from a sales channel
Authorizations:
path Parameters
userId required | string The ID of the user to remove the binding from. |
salesChannelId required | string The sales channel to unbind the user from |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "userId": "cl6aq4et20000mcxd38uh9w24",
- "salesChannelId": "cl6aq6sxp0004snxd516by16w",
- "roles": [
- "TRADERONBOARDERPROPOSAL_VIEWER"
]
}
Grant a user a role
Authorizations:
path Parameters
userId required | string The ID of the user to grant the role to. |
salesChannelId required | string The sales channel to grant the user the role on. |
query Parameters
role required | string Enum: "TRADERONBOARDERPROPOSAL_VIEWER" "TRADERONBOARDERPROPOSAL_ACCEPTER" "TRADER_ADMINISTRATOR" "TRADER_VIEWER" "ROLE_ADMINISTRATOR" "ASSET_VIEWER" "ASSET_OFFRAMPER" "TRANSACTION_ADMINISTRATOR" "PRODUCTIONFACILITY_VIEWER" "SUPPLIER_VIEWER" "EVENT_VIEWER" |
Responses
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "userId": "cl6aq4et20000mcxd38uh9w24",
- "salesChannelId": "cl6aq6sxp0004snxd516by16w",
- "role": "TRADERONBOARDERPROPOSAL_VIEWER"
}
Remove a role from a user
Authorizations:
path Parameters
userId required | string The ID of the user to remove the binding from. |
salesChannelId required | string The sales channel to unbind the user from. |
query Parameters
role required | string Enum: "TRADERONBOARDERPROPOSAL_VIEWER" "TRADERONBOARDERPROPOSAL_ACCEPTER" "TRADER_ADMINISTRATOR" "TRADER_VIEWER" "ROLE_ADMINISTRATOR" "ASSET_VIEWER" "ASSET_OFFRAMPER" "TRANSACTION_ADMINISTRATOR" "PRODUCTIONFACILITY_VIEWER" "SUPPLIER_VIEWER" "EVENT_VIEWER" |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "userId": "cl6aq4et20000mcxd38uh9w24",
- "salesChannelId": "cl6aq6sxp0004snxd516by16w",
- "role": "TRADERONBOARDERPROPOSAL_VIEWER"
}
Accept a trader onboarding proposal
Authorizations:
path Parameters
traderOnboardingProposalId required | string The ID of the trader onboarding proposal to be accepted |
Responses
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "id": "cl1bv7mkq00342qxd0fdt8ko7",
- "name": "ACME Corp Oy",
- "businessId": "FI-123123123",
- "onboardedTraderId": "clcf0shsw026jxdhy4iweinr1",
- "status": "ACCEPTED"
}
Reject a trader onboarding proposal
Rejects a trader onboaring proposal. A rejected trader onboarding proposal cannot be accepted until the account holder who wants to be onboarded re-submits their request to be onboarded.
Authorizations:
path Parameters
traderOnboardingProposalId required | string The ID of the trader onboarding proposal to be accepted |
Responses
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "id": "cl1bv7mkq00342qxd0fdt8ko7",
- "name": "ACME Corp Oy",
- "businessId": "FI-123123123",
- "status": "REJECTED",
- "onboardedTraderId": "string"
}
Create a trader
Authorizations:
header Parameters
Idempotency-Key required | string^[\w-]{1,64}$ A client-side provided unique key to allow idempotently calling this API endpoint. |
Request Body schema: application/jsonrequired
businessId required | string The business ID of the trader. |
name required | string The name of the trader. |
required | object The address of the legal entity which is being registered as a trader. |
Responses
Request samples
- Payload
{- "businessId": "FI-12341234",
- "name": "ACME Corp",
- "address": {
- "zipCode": "00100",
- "city": "Helsinki",
- "countryName": "Finland",
- "street": "Long Street",
- "poBox": "PO-12355"
}
}
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "id": "cl1bv7mkq00342qxd0fdt8ko7",
- "businessId": "FI-12341234",
- "name": "ACME Corp"
}
Update meta-data from an existing trader
Updates a subset of the fields of an existing trader.
Patch requests follow JSON Merge Patch (RFC7396), omit fields from the request which should be left unchanged.
Authorizations:
path Parameters
traderId required | string The ID of the trader to be updated. |
Request Body schema: application/jsonrequired
businessId | string The business ID of the trader. |
name | string The name of the trader. |
object |
Responses
Request samples
- Payload
{- "businessId": "FI-12341234",
- "name": "ACME Corp",
- "address": {
- "zipCode": "string",
- "city": "Helsinki",
- "countryName": "Finland",
- "street": "Long Street",
- "poBox": "string"
}
}
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "id": "cl1bv7mkq00342qxd0fdt8ko7",
- "businessId": "FI-12341234",
- "name": "ACME Corp",
- "address": {
- "zipCode": "00100",
- "city": "Helsinki",
- "countryName": "Finland",
- "street": "Long Street",
- "poBox": "PO-12355"
}
}
List all listable assets for a trader
Returns all listable assets for a trader. Listable assets are assets which can still be traded, retired or offramped.
Authorizations:
path Parameters
traderId required | string The ID of the trader to act upon. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
[- {
- "volume": 100,
- "productionFacilityId": "cl5qo433z000047xdadi2amx0",
- "supplierId": "cl8x3mgx40001xd7o37z3j7yl",
- "methodologyCode": "C03000000",
- "issuingDate": "2020-01-01T00:00:00.000Z",
- "expirationDate": "2025-01-01T00:00:00.000Z",
- "creditTypeId": "CORC",
- "standard": "PURO",
- "countryCode": "FI",
- "productionStartDate": "2020-01-01T00:00:00.000Z",
- "productionEndDate": "2020-12-31T00:00:00.000Z",
- "vintage": 2020,
- "issuanceId": "3c9ff27a-8671-4ce4-8065-107de1912d04",
- "certificates": "PURO_PR_CORC50+_FI_If5RB5_2028_3c9ff27a-8671-4ce4-8065-107de1912d04_1-1000",
- "start": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000001",
- "end": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000100"
}
]
Offramp assets
Starts the process of offramping assets owned by a trader. Invoking this endpoint will create an offramp task, which can be used to track the status of the offramp.
Use the /{taskId}
endpoint to track the status of the created task.
Authorizations:
path Parameters
traderId required | string The ID of the trader to act upon. |
header Parameters
Idempotency-Key required | string^[\w-]{1,64}$ A client-side provided unique key to allow idempotently calling this API endpoint. |
Request Body schema: application/jsonrequired
required | Array of objects non-empty All assets which are involved in this offramp | ||||
Array (non-empty)
|
Responses
Request samples
- Payload
{- "assets": [
- {
- "start": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000001",
- "end": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000100"
}
]
}
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "taskId": "cl3y5zbkb0062wuxd52u85agi",
- "status": "PENDING",
- "idempotencyKey": "cl3y5zbka0036wuxdtoxdl36a",
- "message": "Task is waiting to be picked up.",
- "responsePayload": {
- "id": "cl8vkk621019vxq13r5ey5nik"
}
}
Get status of an offramp task
Returns the status of an existing offramp task.
Authorizations:
path Parameters
traderId required | string The ID of the trader to find the offramp task for. |
taskId required | string The ID of the task to fetch the status from. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "taskId": "cl3y5zbkb0062wuxd52u85agi",
- "status": "PENDING",
- "idempotencyKey": "cl3y5zbka0036wuxdtoxdl36a",
- "message": "Task is waiting to be picked up.",
- "responsePayload": {
- "id": "cl8vkk621019vxq13r5ey5nik"
}
}
Register a trade
Starts the process of registering a trade between two traders. Invoking this endpoint will create a trade task, which can be used to track the status of the trade.
Authorizations:
path Parameters
traderId required | string The ID of the trader who is selling the assets. |
header Parameters
Idempotency-Key required | string^[\w-]{1,64}$ A client-side provided unique key to allow idempotently calling this API endpoint. |
Request Body schema: application/jsonrequired
buyerId required | string The ID of the trader who is buying the assets. |
required | Array of objects non-empty All assets which are involved in this trade |
currency required | string Enum: "EUR" "USD" The currency of the monetary value of this trade. |
Responses
Request samples
- Payload
{- "buyerId": "string",
- "assets": [
- {
- "unitPrice": 0.01,
- "start": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000001",
- "end": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000100"
}
], - "currency": "EUR"
}
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "taskId": "cl3y5zbkb0062wuxd52u85agi",
- "status": "PENDING",
- "idempotencyKey": "cl3y5zbka0036wuxdtoxdl36a",
- "message": "Task is waiting to be picked up.",
- "responsePayload": {
- "id": "cl8vkk621019vxq13r5ey5nik"
}
}
Get status of a trade task
Returns the status of an existing trade task.
Authorizations:
path Parameters
traderId required | string The ID of the trader to find the trade task for. |
taskId required | string The ID of the task to fetch the status from. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "taskId": "cl3y5zbkb0062wuxd52u85agi",
- "status": "PENDING",
- "idempotencyKey": "cl3y5zbka0036wuxdtoxdl36a",
- "message": "Task is waiting to be picked up.",
- "responsePayload": {
- "id": "cl8vkk621019vxq13r5ey5nik"
}
}
Register a retirement
Starts the process of registering a retirement of assets owned by a trader. Invoking this endpoint will create a retirement task, which can be used to track the status of the retirement.
Use the /{taskId}
endpoint to track the status of the created task.
Authorizations:
path Parameters
traderId required | string The ID of the trader who owns the assets which are to be retired. |
header Parameters
Idempotency-Key required | string^[\w-]{1,64}$ A client-side provided unique key to allow idempotently calling this API endpoint. |
Request Body schema: application/jsonrequired
beneficiaryName required | string The name of the beneficiary of the retirement. |
beneficiaryLocation required | string non-empty The location of the beneficiary of the retirement. |
beneficiaryType | string Default: "END_CONSUMER" Enum: "END_CONSUMER" "SUPPLIER" The type of the beneficiary. |
beneficiaryHiddenUntil | string or null <date-time> Default: null The date until which the beneficiary is hidden. |
consumptionCountryCode required | string[A-Z]{2} The code of the country in which the to-be retired certificates are consumed. |
usageType | string Default: "GENERIC_COMPENSATION" Enum: "BUNDLED_WITH_PRODUCT_OR_SERVICE" "DISCLOSURE" "GENERIC_COMPENSATION" "OTHER" "SPECIFIC_ACTIVITY_LIKE_FLIGHTS" "SUPPORT" Type of the activity associated with the retirement. |
required | object The period during which the to-be retired assets where used. |
retirementPurpose required | string non-empty The purpose for which the certificates are retired. |
required | Array of objects non-empty All assets which are involved in this retirement. For all bundles, either all bundles have a monetary unit-price, or none of them do. |
currency required | string or null Enum: "EUR" "USD" The currency of the monetary value of this trade. |
Responses
Request samples
- Payload
{- "beneficiaryName": "ACME Corp Oy",
- "beneficiaryLocation": "Helsinki",
- "beneficiaryType": "END_CONSUMER",
- "beneficiaryHiddenUntil": "2022-01-01T00:00:00.000Z",
- "consumptionCountryCode": "FI",
- "usageType": "GENERIC_COMPENSATION",
- "consumptionPeriod": {
- "start": "2020-01-01T00:00:00.000Z",
- "end": "2020-12-31T00:00:00.000Z"
}, - "retirementPurpose": "To compensate for flight emissions from business trips in 2022.",
- "assets": [
- {
- "unitPrice": 0.01,
- "start": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000001",
- "end": "e0edefa8-cbde-4c19-896a-edafb7a8e030_643002406555908611000000000100"
}
], - "currency": "EUR"
}
Response samples
- 201
- 400
- 401
- 403
- 404
- 429
{- "taskId": "cl3y5zbkb0062wuxd52u85agi",
- "status": "PENDING",
- "idempotencyKey": "cl3y5zbka0036wuxdtoxdl36a",
- "message": "Task is waiting to be picked up.",
- "responsePayload": {
- "id": "cl8vkk621019vxq13r5ey5nik"
}
}
Get status of a retirement task
Returns the status of an existing retirement task.
Authorizations:
path Parameters
taskId required | string The ID of the task to fetch the status from. |
traderId required | string The ID of the trader to find the retirement task for. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "taskId": "cl3y5zbkb0062wuxd52u85agi",
- "status": "PENDING",
- "idempotencyKey": "cl3y5zbka0036wuxdtoxdl36a",
- "message": "Task is waiting to be picked up.",
- "responsePayload": {
- "id": "cl8vkk621019vxq13r5ey5nik"
}
}
List transactions
Returns all transactions for the sales channel.
Authorizations:
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
[- {
- "id": "clcouzeuj0001ppxdc4lx7e5d",
- "type": "TRADE",
- "sellerId": "clcouyzxh0000ppxd5gct7d5c",
- "status": "PENDING",
- "createdAt": "2021-01-01T00:00:00.000Z",
- "completedAt": "2021-01-01T00:00:00.000Z",
- "transactionId": "c86f329c-858a-4530-a5ea-12eebef7e62e",
- "assets": [
- {
- "start": "6e0edefa8-cbde-4c19-896a-edafb7a8e030_43002406555908611000000000001",
- "end": "6e0edefa8-cbde-4c19-896a-edafb7a8e030_43002406555908611000000000001",
- "unitPrice": 100,
- "volume": 1
}
], - "buyerId": "clcouzle50002ppxd7sip8t0w",
- "currency": "EUR"
}
]
Read one production facility
Authorizations:
path Parameters
productionFacilityId required | string The ID of the production facility. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
{- "id": "cl1bv7mkq00342qxd0fdt8ko7",
- "gsrn": "643002406801000015",
- "code": "ABC123",
- "name": "Biochar facility",
- "countryCode": "FI",
- "methodologyCodes": [
- "string"
]
}
List events
Authorizations:
query Parameters
object | |
object | |
$limit | integer >= 1 |
Responses
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
[- {
- "id": "cllwbrxeg000108jq2p8ma1au",
- "eventType": "TRANSACTION_STATUS_CHANGE",
- "createdAt": "2023-03-21T13:05:12.413Z",
- "eventAt": "2023-03-21T13:03:40.000Z",
- "payload": {
- "transactionId": "cln096vo8000008kz09oubiyc",
- "status": "PENDING"
}
}
]