Exchange an approved Cloud consent code for an organisation grant
import requests
url = "https://platform.ankra.app/api/v1/cloud/delegation-grants/exchange"
payload = {
"code": "<string>",
"code_verifier": "<string>",
"client_id": "ankra-cloud",
"redirect_uri": "<string>",
"grant_hash": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"X-Ankra-Cloud-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Ankra-Cloud-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
code_verifier: '<string>',
client_id: 'ankra-cloud',
redirect_uri: '<string>',
grant_hash: '<string>',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://platform.ankra.app/api/v1/cloud/delegation-grants/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/cloud/delegation-grants/exchange \
--header 'Content-Type: application/json' \
--header 'X-Ankra-Cloud-Token: <api-key>' \
--data '
{
"code": "<string>",
"code_verifier": "<string>",
"client_id": "ankra-cloud",
"redirect_uri": "<string>",
"grant_hash": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'{
"grant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"platform_user_id": "<string>",
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z"
}Cloud Delegation
Exchange an approved Cloud consent code for an organisation grant
Authenticates Cloud before reading the body. Atomically consumes a 60-second code, checks S256 PKCE and the exact callback, and rechecks the consenting human and organisation membership. Only the grant hash is stored; Cloud keeps its secret sealed. A directory bearer cannot exchange a code.
POST
/
api
/
v1
/
cloud
/
delegation-grants
/
exchange
Exchange an approved Cloud consent code for an organisation grant
import requests
url = "https://platform.ankra.app/api/v1/cloud/delegation-grants/exchange"
payload = {
"code": "<string>",
"code_verifier": "<string>",
"client_id": "ankra-cloud",
"redirect_uri": "<string>",
"grant_hash": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"X-Ankra-Cloud-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Ankra-Cloud-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
code_verifier: '<string>',
client_id: 'ankra-cloud',
redirect_uri: '<string>',
grant_hash: '<string>',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://platform.ankra.app/api/v1/cloud/delegation-grants/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/cloud/delegation-grants/exchange \
--header 'Content-Type: application/json' \
--header 'X-Ankra-Cloud-Token: <api-key>' \
--data '
{
"code": "<string>",
"code_verifier": "<string>",
"client_id": "ankra-cloud",
"redirect_uri": "<string>",
"grant_hash": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'{
"grant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"platform_user_id": "<string>",
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z"
}Authorizations
Deployment-owned Cloud sync credential, accepting current and next values during rotation.
Body
application/json