Exchange a completed CLI browser-login session
curl --request POST \
--url https://api.peel.sh/public/device/exchange \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_code": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({session_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', user_code: '<string>'})
};
fetch('https://api.peel.sh/public/device/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.peel.sh/public/device/exchange"
payload = {
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_code": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"api_key": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"instance": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"retry": "same_key",
"docs_url": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"instance": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"retry": "same_key",
"docs_url": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"instance": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"retry": "same_key",
"docs_url": "<string>",
"details": {}
}Account
Exchange a completed CLI browser-login session
Polls a pending device-auth session and returns an API key after approval in the signed-in browser.
POST
/
public
/
device
/
exchange
Exchange a completed CLI browser-login session
curl --request POST \
--url https://api.peel.sh/public/device/exchange \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_code": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({session_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', user_code: '<string>'})
};
fetch('https://api.peel.sh/public/device/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.peel.sh/public/device/exchange"
payload = {
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_code": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"api_key": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"instance": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"retry": "same_key",
"docs_url": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"instance": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"retry": "same_key",
"docs_url": "<string>",
"details": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"instance": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"retry": "same_key",
"docs_url": "<string>",
"details": {}
}⌘I