# Callback Example (Basic Implementation)

**To configure and receive callbacks, follow the instructions below**

To create callbacks, you have to achieve the following requirements:

1. You have to be a user of the platform with owner access to at least one mailbox.
2. You have to have a URL that will receive callbacks.
3. You have to be familiar with API (as the callback interface doesn’t have UI).

**If you reached the three points above, you can start configuring your callback**

Create a callback using the following data. This callback will be triggered on each envelope received with the following statuses: WAITING, COMPLETED, EXPIRED, CANCELLED

| **URL**       |                                                                                                                                 |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Method        | POST                                                                                                                            |
| request URL   | /api/v1/envelope/callback/add                                                                                                   |
| **Headers**   |                                                                                                                                 |
| content-type  | application/json                                                                                                                |
| authorization | Bearer {token} where {token} is the authorisation token that which user received after successful authorisation on the platform |
| mailbox       | UUID of the mailbox to which you configured callbacks                                                                           |

**REQUEST BODY**

```markup
 {
  "filter": {},
  "url": "URL which can receive callbacks",
  "retries": 5,
  "timeout": 10000,
  "successCode": 200,
  "login": "",
  "password": ""
}
```

* Send at least one envelope to the mailbox where the callback was created
* Follow to URL you defined in the callback and wait for the callback data
* As soon as your URL receives a callback, you will see the following JSON data (data of UUIDs, status, labels, subject, dates, template and sender will be according to the envelope you received)

```markup
{
  "uuid": "74acfb70-78e9-4ca5-ac73-054c72402c0a",
  "label": ["string"],
  "status": "string",
  "subject": "string",
  "receiveDate": 1676039226765,
  "expireDate": 1678631226504,
  "template": "ebeb302b-597e-4b47-9de2-5ad3a33e4385",
  "sender": "fdfde267-6558-40a9-93fd-e59529baef36"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.docstudio.com/admin-panel/webhooks-callbacks/envelope-callbacks-overview/callback-example-basic-implementation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
