# Ticket Integration

This section provides a guide to the API endpoints for managing and integrating ticket templates. These templates allow you to define the structure and content of tickets created in external systems, such as Jira.

***

## Template Management

## Create a Template

Use this endpoint to create a new ticket template.

<mark style="color:green;">`POST`</mark> `https://{apiUrl}/{tenant}/configuration/integrations/tickets/template`

```json
{
    "name": "template-1",
    "description": "Template for new feature stories",
    "type": "JIRA",
    "props": {
        "jira_project_id": "10000",
        "jira_issue_type_id": "10001",
        "custom_fields": {
            "summary": "template desc"
        }
    }
}
```

Fields:

* `name` (string): A unique name for the template.
* `description` (string, optional): A brief description of the template's purpose.
* `type` (string): Ticket type (currently only `JIRA` is supported)
* `props` (object): Corresponding properties for ticket based on type

#### Jira Prop Fields

* `jira_project_id` (string): The ID of the Jira project to associate with this template.
* `jira_issue_type_id` (string): The ID of the Jira issue type (e.g., "Story," "Bug") for this template.
* `custom_fields` (object): A key-value pair of custom fields to be included in the ticket.

## Update a Template

Use this endpoint to update an existing template. The template ID is included in the URL path.

<mark style="color:orange;">`PUT`</mark> `https://{apiUrl}/{tenant}/configuration/integrations/tickets/template/1`

```json
{
    "name": "template-1",
    "description": "Updated description",
    "type": "JIRA",
    "props": {
        "jira_project_id": "10000",
        "jira_issue_type_id": "10001",
        "custom_fields": {
            "summary": "updated template desc"
        }
    }
}
```

Fields:

* `name` (string): The new name for the template.
* `description` (string, optional): The new description for the template.
* `jira_project_id` (string): The new Jira project ID.
* `jira_issue_type_id` (string): The new Jira issue type ID.
* `custom_fields` (object): The updated custom fields.

## Get a Specific Template

Retrieve the details of a single template using its ID.

<mark style="color:blue;">`GET`</mark> `https://{apiUrl}/{tenant}/configuration/integrations/tickets/template/1`

```json
{
    "id": 1,
    "name": "template-1",
    "description": "Updated description",
    "type": "JIRA",
    "props": {
        "jira_project_id": "10000",
        "jira_issue_type_id": "10001",
        "custom_fields": {
            "summary": "updated template desc"
        }
    }
}
```

## Get All Templates

Retrieve a list of all available ticket templates.

<mark style="color:blue;">`GET`</mark> `https://{apiUrl}/{tenant}/configuration/integrations/tickets/template`

```json
[
    {
        "id": 2,
        "name": "template-2",
        "description": null,
        "type": "JIRA",
        "props": {
            "jira_project_id": "10000",
            "jira_issue_type_id": "10001",
            "custom_fields": {
                "customfield_10014": "TEL-4825"
            }
        }
    },
    {
        "id": 1,
        "name": "template-1",
        "description": "Updated description",
        "type": "JIRA",
        "props": {
            "jira_project_id": "10000",
            "jira_issue_type_id": "10001",
            "custom_fields": {
                "summary": "updated template desc"
            }
        }
    }
]
```

***


---

# 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://docs.telm.ai/telmai/api-reference/ticket-integration-api.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.
