Trash messages in bulk
const url = 'https://api.inboxcnx.com/v1/messages/batch/trash';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"ids":["c4a7e2b9-1d3f-4e6a-8b0c-5f2d9e7a1b34","f0e1d2c3-b4a5-4968-8776-5a4b3c2d1e0f"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.inboxcnx.com/v1/messages/batch/trash \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "ids": [ "c4a7e2b9-1d3f-4e6a-8b0c-5f2d9e7a1b34", "f0e1d2c3-b4a5-4968-8776-5a4b3c2d1e0f" ] }'Trash messages in bulk at the provider: up to 100 messages of one grant per call, each as POST /v1/messages/{id}/trash handles one. Moves a message to the trash at the provider, to delete it the way the end user’s mail client would. The provider empties its trash on its own schedule (Gmail after 30 days). The stored copy stays, and untrash brings it back.
Requires the delete:messages scope.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Example
{ "ids": [ "c4a7e2b9-1d3f-4e6a-8b0c-5f2d9e7a1b34", "f0e1d2c3-b4a5-4968-8776-5a4b3c2d1e0f" ]}Responses
Section titled “Responses”How many moved
object
object
Example generated
{ "updated": 1, "failed": [ { "id": "example", "code": "example" } ]}Invalid body. mixed_grants: the ids belong to more than one grant
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The credential lacks the delete:messages scope
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}messages_not_found: ids lists the unknown ones. provider_message_not_found: the provider no longer has one of them
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}message_deleted: the mail is deleted at the provider. connection_unreadable: the mailbox cannot be reached and may need a reconnect. connection_scope_missing: the end user did not grant the scope the action needs, named in scope. A reconnect grants it
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}provider_unavailable: the provider is down or rate-limits the mailbox. Retry after Retry-After seconds
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}