cURL
curl --request DELETE \
--url https://api.mage.space/v1/references/{reference_id} \
--header 'Authorization: Bearer <token>'import Mage from '@mage-space/sdk';
const mage = new Mage(); // reads MAGE_API_KEY
await mage.references.delete('REFERENCE_ID');from mage_space import Mage
mage = Mage() # reads MAGE_API_KEY
mage.references.delete("REFERENCE_ID")const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mage.space/v1/references/{reference_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"error": {
"code": "unauthorized",
"message": "The API key is invalid or has been revoked."
}
}{
"error": {
"code": "payment_required",
"message": "The Mage API and MCP server need a successful payment on this account first: buy any Gem pack or start a plan at https://www.mage.space/gems, then retry. Signup bonus Gems work in the Mage app only."
}
}{
"error": {
"code": "reference_not_found",
"message": "No reference with this id belongs to the account."
}
}{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side. Retry, and contact support if it persists."
}
}Endpoints
Delete reference
DELETE /v1/references/ removes one of the account’s references; its handle stops resolving at once.
DELETE
/
v1
/
references
/
{reference_id}
cURL
curl --request DELETE \
--url https://api.mage.space/v1/references/{reference_id} \
--header 'Authorization: Bearer <token>'import Mage from '@mage-space/sdk';
const mage = new Mage(); // reads MAGE_API_KEY
await mage.references.delete('REFERENCE_ID');from mage_space import Mage
mage = Mage() # reads MAGE_API_KEY
mage.references.delete("REFERENCE_ID")const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mage.space/v1/references/{reference_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"error": {
"code": "unauthorized",
"message": "The API key is invalid or has been revoked."
}
}{
"error": {
"code": "payment_required",
"message": "The Mage API and MCP server need a successful payment on this account first: buy any Gem pack or start a plan at https://www.mage.space/gems, then retry. Signup bonus Gems work in the Mage app only."
}
}{
"error": {
"code": "reference_not_found",
"message": "No reference with this id belongs to the account."
}
}{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side. Retry, and contact support if it persists."
}
}Remove one of your references by the
id from GET /v1/references. The response is 204 with no body. From then on a prompt that mentions its handle is refused with 400 invalid_config, and the handle may be taken by a new character or reference.
Only your own references can be deleted here; any other id is a 404 reference_not_found. Requests that already ran with the reference keep their results.Authorizations
Create a key in API → API Keys: select Create API key, name it in the popup, then select Create key. Copy the one-time key and send it as Authorization: Bearer mage_sk_…. Keys are for server-side code only.
Path Parameters
The reference's id.
Response
The reference was deleted.
Last modified on September 23, 2026

