# Endpoints

Restful APIs are ready to use to interact with DocKing 😎

### \[GET] api/v1/document-templates

Get a list of templates

Request params:

* limit: default `20`
* page: default `1`

Response:

```javascript
{
    data: DocumentTemplate[],
    ...paginationInfo
}
```

### \[GET] api/v1/document-templates/{uuid}

Get a single template detail.

Response:

```javascript
{
    data: DocumentTemplate,
}
```

### \[POST] api/v1/document-templates

Create a new template.

Body:

```json
{
    "title": "title here",
    "category": "category here",
    "key": "unique identifier key here"
}
```

Response: 201 on OK, 422 on Validation Error

```json
{
    "uuid": "...",
    "created": true
}
```

### \[PUT] api/v1/document-templates/{uuid}

Update an existing template.

Body:

```json
{
    "title": "title here",
    "category": "category here",
    "key": "unique identifier key here",
    "template": "html template here",
    "default_variables": { object of default variable },
    "metadata": { obj of metadata }
}
```

Response: 200 on OK, 422 on Validation Error

```json
{
    "uuid": "...",
    "updated": true
}
```

### \[DELETE] api/v1/document-templates/{uuid}

Delete a single template.

Response: 200 on OK

```json
{
    "uuid": "...",
    "deleted": true
}
```

### \[POST] api/v1/document-templates/{uuid}/pdfs

Render a template with the given data and returns the PDF file URL.

* Body
  * `variables` (JSON object or array)
  * `metadata` (JSON object)
* Response
  * OK: 200 with URL.
  * ERROR:&#x20;
    * 400 with message or outcome.
    * 422 for validation errors.

### \[POST] api/v1/document-templates/{uuid}/pdfs-async

Asynchronously render a new template.

* Body
  * `variables` (JSON object or array)
  * `metadata` (JSON object)
  * `webhook_url` (REQUIRED), for render result notification
* Response
  * OK: 200 with the outcome.
  * ERROR:
    * 422: for validation errors.

### \[GET] api/v1/document-files

Get a list of document files

Request params:

* limit: default `20`
* page: default `1`

Response:

```javascript
{
    data: File[],
    ...paginationInfo
}
```

### \[POST] api/v1/document-files/{uuid}

Returns the single rendered pdf file


---

# 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://docking.shipsaas.tech/usage/endpoints.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.
