AutomatedDocs API - Templates


Create Document

POST https://automateddocs.com/api/document

Creates a new document based on the specified template and data.

Headers

  • Authorization: Bearer {token}
  • Content-Type: multipart/form-data

Replace {token} with your actual bearer token.

Request Body (Form Data)

  • data (required): A JSON string containing the values to fill the template fields. These fields can include text, lists, tables, and image URLs.
  • output_type (required): The desired output file type of the document (e.g., pdf).
  • output_filename (optional): Specifies the filename for the generated document. You can use fields from the template to dynamically generate the file name. If specified here, it overrides any settings specified in the template settings.
  • template_id (required): The UUID of the template to be used for document generation.
  • test (optional): Set to 1 for generating a test document. The default is 0 (not a test document).

Example CURL Command

curl --request POST \
  --url https://automateddocs.com/api/document \
  --header 'Authorization: Bearer 2|7APNZflrkuxeKjJ6rRnsQpOKrv5y7ywasDbVZ1nI2e897de4' \
  --header 'Content-Type: multipart/form-data' \
  --form 'data={
    "variable 1": "variable 1",
    "tag 2": "pepe",
    "tag 3": "",
    "tag 4": "",
    "tag 5": "",
    "EXAMPLE_LIST": [
        {
            "LIST_ITEM": "item 1"
        },
        {
            "LIST_ITEM": "item 2"
        }
    ],
    "TABLE": [
        {
            "COL_1": "sd",
            "COL_2": "sad",
            "COL_3": "asd",
            "COL_4": "asd"
        },
        {
            "COL_1": "123",
            "COL_2": "456",
            "COL_3": "789",
            "COL_4": "098"
        }
    ],
    "IMAGE_TEST": "https://source.unsplash.com/user/c_v_r/300x300"
}' \
  --form output_type=pdf \
  --form 'output_filename=variable 1' \
  --form template_id=5f2adff4-7969-4582-8bc6-68065b9bc952 \
  --form test=0
  • The data field should be filled with the JSON structure according to the template settings page or the GET template API response. It includes all the necessary fields and values required by the chosen template.
  • The template_id should be the UUID obtained from the template settings page or the list of templates API.
  • The output_filename can include placeholders based on the template's fields for dynamic naming. output_type specifies the format of the generated document, with pdf being a common option.
  • The test parameter indicates whether the document is a test (1) or not (0), affecting how it's processed or stored by the system.

Get Documents

GET https://automateddocs.com/api/document

Retrieves a list of documents generated from the templates. This includes metadata about each document such as its status, output type, expiration details, and URLs for downloading or accessing the document on the cloud.

Authentication

This request requires an authentication token to be included in the header.

  • Header: Authorization: Bearer {token}

Replace {token} with your actual bearer token.

Response Format

The response is in JSON format with the following structure:

{
  "success": true,
  "documents": {
    "current_page": "integer",
    "data": [
      {
        "id": "integer",
        "status": "string",
        "output_filename": "string or null",
        "output_type": "string",
        "template_id": "integer",
        "editable": "integer",
        "password": "string or null",
        "test": "integer",
        "expires_at": "datetime",
        "expired": "integer",
        "cloud_id": "string or null",
        "cloud_url": "string or null",
        "created_at": "datetime",
        "updated_at": "datetime",
        "download_url": "string"
      }
      // additional document objects
    ],
    "first_page_url": "string",
    "from": "integer",
    "last_page": "integer",
    "last_page_url": "string",
    "links": [
      {
        "url": "string or null",
        "label": "string",
        "active": "boolean"
      }
      // additional link objects
    ],
    "next_page_url": "string or null",
    "path": "string",
    "per_page": "integer",
    "prev_page_url": "string or null",
    "to": "integer",
    "total": "integer"
  }
}

Get a Document

GET https://automateddocs.com/api/document/{id}

Retrieves detailed information about a specific document identified by its ID.

Parameters

  • id (required): The unique identifier for the document. It should be substituted in the URL.

Authentication

This request requires an authentication token to be included in the header.

  • Header: Authorization: Bearer {token}

Replace {token} with your actual bearer token.

Response Format

The response is in JSON format with the following structure:

{
  "success": true,
  "document": {
    "id": "integer",
    "status": "string",
    "output_filename": "string or null",
    "output_type": "string",
    "template_id": "integer",
    "editable": "integer",
    "password": "string or null",
    "test": "integer",
    "expires_at": "datetime",
    "expired": "integer",
    "cloud_id": "string or null",
    "cloud_url": "string",
    "created_at": "datetime",
    "updated_at": "datetime",
    "download_url": "string"
  }
}

Delete a Document

DELETE http://automateddocs.test/api/document/{id}

Deletes a specific document identified by its ID.

Parameters

  • id (required): The unique identifier for the document. It should be substituted in the URL.

Authentication

This request requires an authentication token to be included in the header.

  • Header: Authorization: Bearer {token}

Replace {token} with your actual bearer token.

Response Format

The response will be in JSON format, typically indicating success:

{
  "success": true,
  "message": "Document deleted successfully"
}