> For the complete documentation index, see [llms.txt](https://docs.certhis.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.certhis.io/mint-api/webhook.md).

# Webhook

#### **Route: `/register_webhook`**

**Description:** This endpoint registers or updates a webhook for a minting API. It requires a valid API key and secret for authentication. The webhook URL must be a valid HTTPS URL. The `webhook_pass` and `webhook_login` parameters are optional but must not exceed 250 characters.

**Method:** POST

**Headers:**

* `api_key` (required): The API key for authentication.
* `api_secret` (required): The API secret for authentication.

**Form Parameters:**

* `webhook` (optional): The URL for the webhook (must be a valid HTTPS URL).
* `webhook_pass` (optional): A password for the webhook (maximum length: 250 characters).
* `webhook_login` (optional): The login for the webhook (maximum length: 250 characters).

**Responses:**

**Success**

* **Status:** 200 OK
* **Content-Type:** application/json
* **Body:**

  ```json
  {
    "status": true,
    "message": "updated"
  }
  ```

**Error**

* **Status:** 400 Bad Request
* **Content-Type:** application/json
* **Body:** Depends on the error; possible messages include:
  * `"api_key or api_secret missing"`
  * `"api_key or api_secret invalid"`
  * `"webhook invalid"`
  * `"webhook_pass invalid"`
  * `"webhook_login invalid"`

***

#### **Route: `/get_webhook`**

**Description:** This endpoint retrieves the current webhook details for a minting API. It requires a valid API key and secret for authentication.

**Method:** GET

**Headers:**

* `api_key` (required): The API key for authentication.
* `api_secret` (required): The API secret for authentication.

**Responses:**

**Success**

* **Status:** 200 OK
* **Content-Type:** application/json
* **Body:**

  ```json
  {
    "status": true,
    "data": {
      "webhook": "https://your-webhook-url.com",
      "webhook_pass": "your_webhook_password",
      "webhook_login": "your_webhook_login"
    }
  }
  ```

**Error**

* **Status:** 400 Bad Request
* **Content-Type:** application/json
* **Body:** Depends on the error; possible messages include:
  * `"api_key or api_secret missing"`
  * `"api_key or api_secret invalid"`

***

#### **Webhook Payload**

**Description:** When the webhook is triggered, the API sends a request with the following payload to the registered webhook URL.

**Payload Body:**

```json
{
  "to": "email",  // The email address of the person who minted the NFT, if it exists.
  "nft_object": "nft",  // Detailed information about the minted NFT.
  "collection_object": "collection",  // Information about the collection to which the NFT belongs.
  "url_nft": "https://certhis.io/nft/137/0x489a64E2Ffc92CDF9Dd125cD6F6e2c00deE8B8bd/1",  // URL on the Certhis site where the NFT can be viewed or retrieved.
  "apple_wallet_link": "url_apple",  // Direct link from the Certhis API to add the NFT to Apple Wallet.
  "google_wallet_link": "url_google"  // Direct link from the Certhis API to add the NFT to Google Wallet.
}
```

**Example Response that the Webhook Receives:**

When your webhook URL receives the payload from the API, it is expected to process the information and respond accordingly. Typically, the webhook should acknowledge receipt of the data.

**Success Response**

* **Status:** 200 OK
* **Content-Type:** application/json

**Error Response** If there is an error processing the webhook data, your server should respond with the appropriate error message.

* **Status:** 400 Bad Request
* **Content-Type:** application/json


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.certhis.io/mint-api/webhook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
