Skip to main content

List Pix Keys

This endpoint returns all Pix keys registered for your customer. Use this route to check which keys are already active before attempting to register a new one.


Endpoint​

  • Method: GET
Endpoint URL
https://api.xgateglobal.com/pix/customer/CLIENT_ID/key
Important

The CLIENT_ID field refers to the customer ID; if you haven't created it yet, you can create it from the create customers page.


Test Integration​

Use the form below to simulate listing Pix keys.

🚀

Test: List Pix Keys

1. Your Credentials

2. Which customer do you want to check?
Don't have a client? Click here to create

Request​

The request does not require a body (body); only authentication Headers.

Required Headers​

HeaderValueDescription
AuthorizationBearer <your_token>The JWT token obtained at login.

URL Parameters​

ParameterTypeRequiredDescription
CLIENT_IDstringYesThe _id of the customer whose key list you want to query.

Responses​

Success (200 OK)​

Returns a list (array) of objects, where each object is a registered key.

[
{
"key": "+5512************",
"type": "PHONE",
"_id": "68fa5d54004*************"
}
]

Common Errors​

StatusMessageLikely Cause
401Unauthorized• Invalid or expired token.
• Invalid or missing header.
• IP not allowed.
404Not FoundCustomer not found.
500Internal Server ErrorInternal server error. Contact support.

How to use​

The main purpose of listing keys is to allow the user to select one to perform a withdrawal (Withdraw).

The response from this endpoint provides the Full Object of the key, which is required when building the withdrawal payload.

Integration Flow​

  1. List the keys: Call this endpoint (GET /pix/customer/CLIENT_ID/key).
  2. Selection: Choose which key you want to use, if there is more than one (e.g., the first in the list).
  3. Submit: You must pass the entire object inside the pixKey property in the withdrawal payload.
Format Warning

Do not send incomplete Pix key data. The withdrawal payload expects the complete JSON object containing key, type, and _id.

Practical Example​

1. What you receive when listing Pix keys:

[
{
"key": "+5512**********",
"type": "PHONE",
"_id": "68fa5d5400**********"
}
]

2. How you should send it in the Withdrawal (POST /withdraw):

You will take the object above and inject it inside pixKey:

{
"amount": 0.2,
"customerId": "68e7b8****************",
"currency": {
"_id": "67339fa800****************",
"name": "BRL",
"type": "PIX",
"symbol": "R$",
"createdDate": "2024-11-12T18:34:16.289Z",
"updatedDate": "2024-11-12T18:34:16.289Z",
"__v": 0
},
"pixKey": {
"key": "+5512**********",
"type": "PHONE",
"_id": "68fa5d5400**********"
}
}

Each field in this JSON is explained on the create withdrawal request page.


Integration​

The integration example uses the Axios library in Node.js.

Installing Axios:

npm install axios

JavaScript Example:

const axios = require("axios");

(async () => {
const email = "your_email@domain.com";
const password = "**********";
const customerId = "12************"

try {
const url_api = "https://api.xgateglobal.com"
const login = await axios.post(`${url_api}/auth/token`, { email, password });
const { data } = await axios.get(`${url_api}/pix/customer/${customerId}/key`, {
headers: {
"Authorization": `Bearer ${login.data.token}`
}
});
console.log(data); // Response
} catch (error) {
console.log(error.response.data.message) // Error
}
})();