Delete intents (single or multiple)
LegacyAPI v1 is the older API. It still works and is supported, but new integrations should use API v2. Migrating from v1 to v2
const url = 'https://app.stoqapp.com/api/v1/external/intents/bulk_destroy';const options = { method: 'DELETE', headers: {'X-Auth-Token': '<X-Auth-Token>', 'Content-Type': 'application/json'}, body: '{"intent_ids":["8f3c2b1a-7d4e-4c2a-9f10-2b3c4d5e6f70","1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request DELETE \ --url https://app.stoqapp.com/api/v1/external/intents/bulk_destroy \ --header 'Content-Type: application/json' \ --header 'X-Auth-Token: <X-Auth-Token>' \ --data '{ "intent_ids": [ "8f3c2b1a-7d4e-4c2a-9f10-2b3c4d5e6f70", "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809" ] }'Delete one or more intents by their IDs. Only intents that have not been sent (notified_at is null) can be deleted. If any of the intents have been sent, the entire operation will fail and return a 422 error with the IDs of sent intents. You can pass a single intent ID in the array to delete just one intent.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”API key for authentication
Request Bodyrequired
Section titled “Request Bodyrequired”object
Array of intent IDs to delete
Example
{ "intent_ids": [ "8f3c2b1a-7d4e-4c2a-9f10-2b3c4d5e6f70", "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809" ]}Responses
Section titled “Responses”All intents deleted successfully
object
Number of intents successfully deleted
Example
{ "success": true, "deleted_count": 2}Bad request - invalid parameters
object
Example generated
{ "error": "example"}Unauthorized
No valid intents found
object
Example generated
{ "error": "example"}Cannot delete intents that have already been sent
object
IDs of intents that have already been sent and cannot be deleted
Example generated
{ "error": "example", "sent_intent_ids": [ "example" ]}Thanks for letting us know.
Still stuck? Ask Quinn or chat with support