Identificar chave
curl --request GET \
--url https://api.upag.io/v1/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account": "<string>",
"type": "<string>",
"permissions": [
"<string>"
]
}
'const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({account: '<string>', type: '<string>', permissions: ['<string>']})
};
fetch('https://api.upag.io/v1/me', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/me';
const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({account: '<string>', type: '<string>', permissions: ['<string>']})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Chave de API
Identificar chave
Retorna a conta, o tipo e as permissões da chave de API usada
GET
https://api.upag.io
/
v1
/
me
Identificar chave
curl --request GET \
--url https://api.upag.io/v1/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account": "<string>",
"type": "<string>",
"permissions": [
"<string>"
]
}
'const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({account: '<string>', type: '<string>', permissions: ['<string>']})
};
fetch('https://api.upag.io/v1/me', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/me';
const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({account: '<string>', type: '<string>', permissions: ['<string>']})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Informa a quem a chave de API pertence: a conta, o tipo da chave (
secret ou publishable) e as permissões dela. Útil para validar uma chave recebida de um merchant.
Sem permissão específica: qualquer chave válida, secreta ou publicável, pode perguntar quem ela é.
Os exemplos usam o sandbox (
https://api.upag.dev/v1). Em produção use https://api.upag.io/v1 com sk_live_….Endpoint
curl https://api.upag.dev/v1/me \
-H "Authorization: Bearer sk_test_your_api_key"
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
const me = await upag.me.retrieve();
Resposta
200 OK
Response
{
"account": "a3d5e7f9-1b2c-4d6e-8f01-2a3b4c5d6e7f",
"type": "secret",
"permissions": [
"charge.read",
"charge.write",
"customer.read",
"customer.write",
"card.read",
"card.write",
"transfer.read",
"transfer.write"
]
}
string
UUID da conta dona da chave.
string
secret ou publishable.string[]
Permissões da chave, no formato
recurso.read / recurso.write.Erros
| Status | Causa |
|---|---|
401 | Chave ausente, desconhecida ou revogada |