> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/b2b/notification-template.md).

# Notification Template

Notification template is template message to generate mail body when sending a specific mail for each action.

## Create Notification Template

**Example Request**

```
curl --location '{host}/api/v1/notification-templates/' \
--header 'Authorization: Token {Token}' \
--header 'Content-Type: application/json' \
--data '{
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created."
}'
```

**Example Response (200 OK)**

```json
{
    "id": 8,
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created.",
    "created_at": "2024-02-01T14:49:27.613403Z",
    "modified_at": "2024-02-01T14:49:27.614573Z"
}
```

**Example Response (400 Bad Request)**

```json
{
    "notification_type": [
        "notification template with this notification type already exists."
    ]
}
```

## List Notification Templates

**Example Request**

```
curl --location '{host}/api/v1/notification-templates/' \
--header 'Authorization: Token {Token}'
```

**Example Response (200 OK)**

```json
{
    "count": 5,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 8,
            "notification_type": "quotation_created",
            "subject": "quotation_created",
            "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created.",
            "created_at": "2024-02-01T14:49:27.613403Z",
            "modified_at": "2024-02-01T14:49:27.614573Z"
        },
    ],
    ...
}
```

## Get Single Notification Template

**Example Request**

```
curl --location '{host}/api/v1/notification-templates/1/' \
--header 'Authorization: Token {Token}'
```

**Example Response (200 OK)**

```json
{
    "id": 1,
    "notification_type": "quotation_created1",
    "subject": "quotation_created",
    "template": "quotation_created",
    "created_at": "2023-11-15T14:56:16.835914Z",
    "modified_at": "2023-11-15T14:56:16.835923Z"
}
```

**Example Response (404 Not Found)**

```json
{
    "detail": "Not found."
}
```

## Update Notification Template

**Example Request**

```
curl --location --request GET '{host}/api/v1/notification-templates/8/' \
--header 'Authorization: Token {Token}' \
--header 'Content-Type: application/json' \
--data '{
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "{{ quotation.number }} {{ quotation.name }} {{ quotation.user.email }} updated"
}'
```

**Example Response (200 OK)**

```json
{
    "id": 8,
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created.",
    "created_at": "2024-02-01T14:49:27.613403Z",
    "modified_at": "2024-02-01T14:49:27.614573Z"
}
```

## Delete Notification Template

**Example Request**

```
curl --location --request DELETE '{host}/api/v1/notification-templates/8/' \
--header 'Authorization: Token {Token}' \
--header 'Content-Type: application/json' \
--data '{
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "{{ quotation.number }} {{ quotation.name }} {{ quotation.user.email }} updated"
}'
```

**Example Response (204 No Content)**

`204 No Content`


---

# 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://apidocs.akinon.com/b2b/notification-template.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.
