Skip to main content

Remove Pix Key

This endpoint allows removing a customer's Pix key.


Endpoint​

  • Method: DELETE
Endpoint URL
https://api.xgateglobal.com/pix/customer/CLIENT_ID/key/remove/KEY_ID
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.

Important

The KEY_ID field refers to the Pix key ID; if you haven't created it yet, you can create one from the create Pix key page.


Test Integration​

Use the form below to simulate removing a real Pix key.

🗑️

Test: Remove Pix Key

1. Your Credentials

2. Which key do you want to remove?
Don't have a client? Click here to create.
Don't know the key ID? List registered keys.

Request​

Required Headers​

HeaderValueDescription
AuthorizationBearer <seu_token>JWT authentication token.

URL Parameters​

ParameterTypeRequiredDescription
CLIENT_IDstringYesThe _id of the customer whose Pix key you want to delete.
KEY_IDstringYesThe _id of the Pix key to remove.

Responses​

Success (201 Created)​

The key was successfully removed.

{
"message": "Chave Pix removida com sucesso"
}

Common Errors​

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

How to use​

This endpoint allows maintenance of a user's key list by removing obsolete, incorrect, or no longer used keys for withdrawals.

Once removed, the key can no longer be used in any withdrawal transaction (/withdraw).

Integration Flow​

To delete a key you need to know its ID (_id). Common flow:

  1. List: Call the customer's keys (GET /pix/customer/{id}/key) to view available options.
  2. Identify: Capture the _id of the key you want to remove.
  3. Remove: Send that _id in the URL of this deletion endpoint.
Destructive Action

Removal is permanent. If a user attempts a withdrawal using an object of a key that has already been deleted, the API will return a validation error.

Practical Example​

1. Finding the ID in the listing: When listing keys you will see the _id field.

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

2. Building the deletion URL:

You must insert the customer ID and the key ID into the route:

DELETE /pix/customer/68e7b8f0db*************/key/remove/68fa5d54004*************

3. The response:

Expected response is success (201 Created):

{
"message": "Chave Pix removida com sucesso"
}

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************";
const keyId = "1A***********";

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