# Templates API

## Get All Templates

<mark style="color:blue;">`GET`</mark> `https://integrator.dckap.com/api/templates/get/all`

Retrieves all the public templates and also, private templates (associated to the account)

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Authorization | string | Bearer {access\_token} |

{% tabs %}
{% tab title="200 Successfull Response" %}

```
{
    "additional_data": null,
    "data": [
        {
            "_id": "6026068415bea94e909c5d6e",
            "account_id": "5db04e9e2943b4255fe71d0a",
            "author_name": "Sureka Selvam",
            "created_at": "Fri, 12 Feb 2021 04:39:32 GMT",
            "created_by": "5db04e9e2943b4255fe71d0a",
            "detailed_description": "<p>dfd</p>",
            "isDeleted": false,
            "is_published": true,
            "last_published_version": "1.0.2",
            "pipe_description": {},
            "pipes": [
                "5f89ae892943b4000fc54005",
                "5facbf252943b4000d4b1a76"
            ],
            "project_id": "5f894b9d2943b4000fc53044",
            "published_on": "Sat, 13 Feb 2021 16:53:53 GMT",
            "short_description": "sdfdf",
            "template_name": "Test_API",
            "type": "public",
            "updated_at": "Sat, 13 Feb 2021 16:53:55 GMT",
            "updated_by": "AnonymousUser",
            "version_info": "master"
        },
        {
            "_id": "6026066615bea94e909c5d6b",
            "account_id": "5db04e9e2943b4255fe71d0a",
            "author_name": "Sureka Selvam",
            "created_at": "Fri, 12 Feb 2021 04:39:02 GMT",
            "created_by": "5db04e9e2943b4255fe71d0a",
            "detailed_description": "<p>dfd</p>",
            "isDeleted": false,
            "is_published": true,
            "last_published_version": "master",
            "pipe_description": {},
            "pipes": [
                "5f89ae892943b4000fc54005",
                "5facbf252943b4000d4b1a76"
            ],
            "project_id": "5f894b9d2943b4000fc53044",
            "published_on": "Fri, 12 Feb 2021 04:39:02 GMT",
            "short_description": "sdfdf",
            "template_name": "Test",
            "type": "public",
            "updated_at": "Fri, 12 Feb 2021 04:39:02 GMT",
            "updated_by": "5db04e9e2943b4255fe71d0a",
            "version_info": "master"
        },
        {
            "_id": "6026056515bea94e909c5d5b",
            "account_id": "5db04e9e2943b4255fe71d0a",
            "author_name": "Sureka Selvam",
            "created_at": "Fri, 12 Feb 2021 04:34:45 GMT",
            "created_by": "5db04e9e2943b4255fe71d0a",
            "detailed_description": "<p>dfd</p>",
            "isDeleted": false,
            "is_published": true,
            "last_published_version": "1.0.1",
            "pipe_description": {},
            "pipes": [
                "5f89ae892943b4000fc54005",
                "5facbf252943b4000d4b1a76"
            ],
            "project_id": "5f894b9d2943b4000fc53044",
            "published_on": "Fri, 12 Feb 2021 04:35:30 GMT",
            "short_description": "sdfdf",
            "template_name": "Test",
            "type": "public",
            "updated_at": "Fri, 12 Feb 2021 04:35:30 GMT",
            "updated_by": "5db04e9e2943b4255fe71d0a",
            "version_info": "master"
        }
    ],
    "error_code": "",
    "message": "Templates listed successfully",
    "next": 0,
    "page": 1,
    "pages": [],
    "prev": 0,
    "status": 200,
    "success": true,
    "total": 1,
    "total_records": 3
}
```

{% endtab %}

{% tab title="401 Auth" %}

```
{
    "data": null,
    "message": "UserWarning('Suspicious login attempt',)",
    "response_status": 401,
    "status": false,
    "status_code": 401
}
```

{% endtab %}
{% endtabs %}

## Get Template Information

<mark style="color:blue;">`GET`</mark> `https://integrator.dckap.com/api/get/template/:id`

Retrieves the template information for the given template id.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Template ID |

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Authorization | string | Bearer {access\_token} |

{% tabs %}
{% tab title="200 " %}

```
{
    "additional_data": {},
    "data": {
        "_id": "6026056515bea94e909c5d5b",
        "account_id": "5db04e9e2943b4255fe71d0a",
        "author_name": "Sureka Selvam",
        "created_at": "Fri, 12 Feb 2021 04:34:45 GMT",
        "created_by": "5db04e9e2943b4255fe71d0a",
        "detailed_description": "<p>dfd</p>",
        "draft": false,
        "error": false,
        "isDeleted": false,
        "is_published": true,
        "last_published_version": "1.0.1",
        "message": "Draft Copy Saved",
        "other_data": {
            "api_managers": [],
            "credentials": [],
            "flows": [],
            "pipes": [],
            "systems": []
        },
        "pipe_description": {},
        "pipes": [
            "5f89ae892943b4000fc54005",
            "5facbf252943b4000d4b1a76"
        ],
        "processing": true,
        "project_id": "5f894b9d2943b4000fc53044",
        "published_on": "Fri, 12 Feb 2021 04:35:30 GMT",
        "release_notes": "<p>sdfdf</p>",
        "short_description": "sdfdf",
        "status": true,
        "systems": [],
        "template_name": "Test",
        "type": "public",
        "updated_at": "Fri, 12 Feb 2021 04:35:30 GMT",
        "updated_by": "5db04e9e2943b4255fe71d0a",
        "version_history": [
            "1.0.0",
            "1.0.1"
        ],
        "version_ids": {
            "1.0.0": "6026056615bea94e909c5d5c",
            "1.0.1": "6026059215bea94e909c5d65"
        },
        "version_info": "master"
    },
    "error_code": "",
    "message": "Success",
    "status": 200,
    "success": true
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "data": null,
    "message": "UserWarning('Suspicious login attempt',)",
    "response_status": 401,
    "status": false,
    "status_code": 401
}
```

{% endtab %}
{% endtabs %}

## Use Template&#x20;

<mark style="color:green;">`POST`</mark> `https://integrator.dckap.com/workspace/:project_id/import/template/:template_id`

Creates the pipes, flows, systems & API's in the specified project using the existing template.

#### Path Parameters

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| project\_id<mark style="color:red;">\*</mark>  | string | Project ID  |
| template\_id<mark style="color:red;">\*</mark> | string | Template ID |

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Authorization | string | Bearer {access\_token} |

#### Request Body

| Name                                                          | Type   | Description                                             |
| ------------------------------------------------------------- | ------ | ------------------------------------------------------- |
| existing\_credentials                                         | object | Existing Credentials                                    |
| created\_credentials                                          | array  | Credentials to be created                               |
| pipes                                                         | object | Pipes ID's with configuration, status and selected flag |
| global\_systems\_as\_custom<mark style="color:red;">\*</mark> | array  | Public System to be created as private system           |

{% tabs %}
{% tab title="200 Successfull Response" %}

```
{
    "additional_data": {},
    "data": {
        "apimanager": [
            "6034a50215bea97a2c6fa6d8",
            "6034a50215bea97a2c6fa6d9",
            "6034a50215bea97a2c6fa6da",
            "6034a50215bea97a2c6fa6db"
        ],
        "credentials": [
            "6034a50215bea97a2c6fa6de",
            "6034a50215bea97a2c6fa6e0"
        ],
        "flows": [
            "6034a50215bea97a2c6fa6e1",
            "6034a50215bea97a2c6fa6e2"
        ],
        "pipes": [
            "6034a50215bea97a2c6fa6dc",
            "6034a50215bea97a2c6fa6dd"
        ],
        "systems": [
            "6034a50215bea97a2c6fa6dc",
            "6034a50215bea97a2c6fa6dd"
        ]
    },
    "error_code": "",
    "message": "Exchange Request Accepted",
    "status": 200,
    "success": true
}
```

{% endtab %}

{% tab title="401 Authentication Error" %}

```
```

{% endtab %}
{% endtabs %}

#### Sample Request Info

```
{
    "existing_credentials": {},
    "created_credentials": [
        {
            "cr_name": "new shopify",
            "cr_hostname": "http://0.0.0.0:2020/",
            "datapoint": "5e844d312943b47e0bff2a98",
            "cr_timezone": "America/Boa_Vista",
            "all_keys": "[{\"label\":\"Username\",\"required\":\"true\",\"type\":\"text\",\"@code\":\"username\"},{\"label\":\"Password\",\"required\":\"true\",\"type\":\"text\",\"@code\":\"password\"}]",
            "username": "est",
            "password": "test"
        },
        {
            "cr_name": "new dell",
            "cr_hostname": "http://0.0.0.0:2020/",
            "datapoint": "5f894b522943b4000fc5303a",
            "cr_timezone": "America/Boa_Vista",
            "all_keys": "[]"
        }
    ],
    "global_systems_as_custom": [
        "5e8edf122943b453ddc13582"
    ],
    "pipes": {
        "5f89ae892943b4000fc54005": {
            "configs": {},
            "pipe_status": true,
            "console_status": true,
            "selected": true
        },
        "5facbf252943b4000d4b1a76": {
            "configs": {
                    "statuses_to_be_processed": "None,partial"
                }
            ],
            "pipe_status": true,
            "console_status": true,
            "selected": true
        }
    }
}
```


---

# 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.dckapintegrator.com/api/templates.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.
