openapi-directory
Version:
Building & bundling https://github.com/APIs-guru/openapi-directory for easy use from JS
1 lines • 81.8 kB
JSON
{"openapi":"3.0.3","servers":[{"url":"https://us1.pdfgeneratorapi.com/api/v3"}],"info":{"contact":{"email":"support@pdfgeneratorapi.com","name":"Support","url":"https://support.pdfgeneratorapi.com"},"description":"# Introduction\nPDF Generator API allows you easily generate transactional PDF documents and reduce the development and support costs by enabling your users to create and manage their document templates using a browser-based drag-and-drop document editor.\n\nThe PDF Generator API features a web API architecture, allowing you to code in the language of your choice. This API supports the JSON media type, and uses UTF-8 character encoding.\n\nYou can find our previous API documentation page with references to Simple and Signature authentication [here](https://docs.pdfgeneratorapi.com/legacy).\n\n## Base URL\nThe base URL for all the API endpoints is `https://us1.pdfgeneratorapi.com/api/v3`\n\nFor example\n* `https://us1.pdfgeneratorapi.com/api/v3/templates`\n* `https://us1.pdfgeneratorapi.com/api/v3/workspaces`\n* `https://us1.pdfgeneratorapi.com/api/v3/templates/123123`\n\n## Editor\nPDF Generator API comes with a powerful drag & drop editor that allows to create any kind of document templates, from barcode labels to invoices, quotes and reports. You can find tutorials and videos from our [Support Portal](https://support.pdfgeneratorapi.com).\n* [Component specification](https://support.pdfgeneratorapi.com/en/category/components-1ffseaj/)\n* [Expression Language documentation](https://support.pdfgeneratorapi.com/en/category/expression-language-q203pa/)\n* [Frequently asked questions and answers](https://support.pdfgeneratorapi.com/en/category/qanda-1ov519d/)\n\n## Definitions\n\n### Organization\nOrganization is a group of workspaces owned by your account.\n\n### Workspace\nWorkspace contains templates. Each workspace has access to their own templates and organization default templates.\n\n### Master Workspace\nMaster Workspace is the main/default workspace of your Organization. The Master Workspace identifier is the email you signed up with.\n\n### Default Template\nDefault template is a template that is available for all workspaces by default. You can set the template access type under Page Setup. If template has \"Organization\" access then your users can use them from the \"New\" menu in the Editor.\n\n### Data Field\nData Field is a placeholder for the specific data in your JSON data set. In this example JSON you can access the buyer name using Data Field `{paymentDetails::buyerName}`. The separator between depth levels is :: (two colons). When designing the template you don’t have to know every Data Field, our editor automatically extracts all the available fields from your data set and provides an easy way to insert them into the template.\n```\n{\n \"documentNumber\": 1,\n \"paymentDetails\": {\n \"method\": \"Credit Card\",\n \"buyerName\": \"John Smith\"\n },\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"Item one\"\n }\n ]\n}\n```\n\n* * * * *\n# Authentication\nThe PDF Generator API uses __JSON Web Tokens (JWT)__ to authenticate all API requests. These tokens offer a method to establish secure server-to-server authentication by transferring a compact JSON object with a signed payload of your account’s API Key and Secret.\nWhen authenticating to the PDF Generator API, a JWT should be generated uniquely by a __server-side application__ and included as a __Bearer Token__ in the header of each request.\n\n## Legacy Simple and Signature authentication\nYou can find our legacy documentation for Simple and Signature authentication [here](https://docs.pdfgeneratorapi.com/legacy).\n\n<SecurityDefinitions />\n\n## Accessing your API Key and Secret\nYou can find your __API Key__ and __API Secret__ from the __Account Settings__ page after you login to PDF Generator API [here](https://pdfgeneratorapi.com/login).\n\n## Creating a JWT\nJSON Web Tokens are composed of three sections: a header, a payload (containing a claim set), and a signature. The header and payload are JSON objects, which are serialized to UTF-8 bytes, then encoded using base64url encoding.\n\nThe JWT's header, payload, and signature are concatenated with periods (.). As a result, a JWT typically takes the following form:\n```\n{Base64url encoded header}.{Base64url encoded payload}.{Base64url encoded signature}\n```\n\nWe recommend and support libraries provided on [jwt.io](https://jwt.io/). While other libraries can create JWT, these recommended libraries are the most robust.\n\n### Header\nProperty `alg` defines which signing algorithm is being used. PDF Generator API users HS256.\nProperty `typ` defines the type of token and it is always JWT.\n```\n{\n \"alg\": \"HS256\",\n \"typ\": \"JWT\"\n}\n```\n\n### Payload\nThe second part of the token is the payload, which contains the claims or the pieces of information being passed about the user and any metadata required.\nIt is mandatory to specify the following claims:\n* issuer (`iss`): Your API key\n* subject (`sub`): Workspace identifier\n* expiration time (`exp`): Timestamp (unix epoch time) until the token is valid. It is highly recommended to set the exp timestamp for a short period, i.e. a matter of seconds. This way, if a token is intercepted or shared, the token will only be valid for a short period of time.\n\n```\n{\n \"iss\": \"ad54aaff89ffdfeff178bb8a8f359b29fcb20edb56250b9f584aa2cb0162ed4a\",\n \"sub\": \"demo.example@actualreports.com\",\n \"exp\": 1586112639\n}\n```\n\n### Signature\nTo create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. The signature is used to verify the message wasn't changed along the way, and, in the case of tokens signed with a private key, it can also verify that the sender of the JWT is who it says it is.\n```\nHMACSHA256(\n base64UrlEncode(header) + \".\" +\n base64UrlEncode(payload),\n API_SECRET)\n```\n\n### Putting all together\nThe output is three Base64-URL strings separated by dots. The following shows a JWT that has the previous header and payload encoded, and it is signed with a secret.\n```\neyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhZDU0YWFmZjg5ZmZkZmVmZjE3OGJiOGE4ZjM1OWIyOWZjYjIwZWRiNTYyNTBiOWY1ODRhYTJjYjAxNjJlZDRhIiwic3ViIjoiZGVtby5leGFtcGxlQGFjdHVhbHJlcG9ydHMuY29tIn0.SxO-H7UYYYsclS8RGWO1qf0z1cB1m73wF9FLl9RCc1Q\n\n// Base64 encoded header: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\n// Base64 encoded payload: eyJpc3MiOiJhZDU0YWFmZjg5ZmZkZmVmZjE3OGJiOGE4ZjM1OWIyOWZjYjIwZWRiNTYyNTBiOWY1ODRhYTJjYjAxNjJlZDRhIiwic3ViIjoiZGVtby5leGFtcGxlQGFjdHVhbHJlcG9ydHMuY29tIn0\n// Signature: SxO-H7UYYYsclS8RGWO1qf0z1cB1m73wF9FLl9RCc1Q\n```\n\n## Testing with JWTs\nYou can create a temporary token in [Account Settings](https://pdfgeneratorapi.com/account/organization) page after you login to PDF Generator API. The generated token uses your email address as the subject (`sub`) value and is valid for __5 minutes__.\nYou can also use [jwt.io](https://jwt.io/) to generate test tokens for your API calls. These test tokens should never be used in production applications.\n* * * * *\n\n# Libraries and SDKs\n## Postman Collection\nWe have created a [Postman](https://www.postman.com) Collection so you can easily test all the API endpoints wihtout developing and code. You can download the collection [here](https://app.getpostman.com/run-collection/329f09618ec8a957dbc4) or just click the button below.\n\n[](https://app.getpostman.com/run-collection/329f09618ec8a957dbc4)\n\n## Client Libraries\nAll our Client Libraries are auto-generated using [OpenAPI Generator](https://openapi-generator.tech/) which uses the OpenAPI v3 specification to automatically generate a client library in specific programming language.\n\n* [PHP Client](https://github.com/pdfgeneratorapi/php-client)\n* [Java Client](https://github.com/pdfgeneratorapi/java-client)\n* [Ruby Client](https://github.com/pdfgeneratorapi/ruby-client)\n* [Python Client](https://github.com/pdfgeneratorapi/python-client)\n* [Javascript Client](https://github.com/pdfgeneratorapi/javascript-client)\n\nWe have validated the generated libraries, but let us know if you find any anomalies in the client code.\n* * * * *\n\n# Error codes\n\n| Code | Description |\n|--------|--------------------------------|\n| 401 | Unauthorized |\n| 403 | Forbidden |\n| 404 | Not Found |\n| 422 | Unprocessable Entity |\n| 500 | Internal Server Error |\n\n## 401 - Unauthorized\n| Description |\n|-------------------------------------------------------------------------|\n| Authentication failed: request expired |\n| Authentication failed: workspace missing |\n| Authentication failed: key missing |\n| Authentication failed: property 'iss' (issuer) missing in JWT |\n| Authentication failed: property 'sub' (subject) missing in JWT |\n| Authentication failed: property 'exp' (expiration time) missing in JWT |\n| Authentication failed: incorrect signature |\n\n## 403 - Forbidden\n| Description |\n|-------------------------------------------------------------------------|\n| Your account has exceeded the monthly document generation limit. |\n| Access not granted: You cannot delete master workspace via API |\n| Access not granted: Template is not accessible by this organization |\n| Your session has expired, please close and reopen the editor. |\n\n## 404 Entity not found\n| Description |\n|-------------------------------------------------------------------------|\n| Entity not found |\n| Resource not found |\n| None of the templates is available for the workspace. |\n\n## 422 Unprocessable Entity\n| Description |\n|-------------------------------------------------------------------------|\n| Unable to parse JSON, please check formatting |\n| Required parameter missing |\n| Required parameter missing: template definition not defined |\n| Required parameter missing: template not defined |\n","title":"PDF Generator API","version":"3.1.1","x-apisguru-categories":["text"],"x-logo":{"altText":"PDF Generator API","backgroundColor":"#3F46AD","href":"https://docs.pdfgeneratorapi.com","url":"https://pdfgeneratorapi.com/assets/web/images/logo_and_text_white.png"},"x-origin":[{"format":"openapi","url":"https://docs.pdfgeneratorapi.com/api-docs.json?_c=1590697087","version":"3.0"}],"x-providerName":"pdfgeneratorapi.com"},"security":[{"JSONWebTokenAuth":[]}],"tags":[{"description":"<SchemaDefinition schemaRef=\"#/components/schemas/Template\" />\n","name":"template_model","x-displayName":"Template"},{"description":"<SchemaDefinition schemaRef=\"#/components/schemas/TemplateDefinition\" />\n","name":"template_definition","x-displayName":"Template Definition"},{"description":"<SchemaDefinition schemaRef=\"#/components/schemas/Component\" />\n","name":"component_model","x-displayName":"Component"},{"description":"<SchemaDefinition schemaRef=\"#/components/schemas/Workspace\" />\n","name":"workspace_model","x-displayName":"Workspace"}],"paths":{"/templates":{"get":{"description":"Returns a list of templates available for the authenticated workspace","operationId":"getTemplates","responses":{"200":{"$ref":"#/components/responses/listOfTemplates"},"401":{"$ref":"#/components/responses/error401"},"403":{"$ref":"#/components/responses/error403"},"404":{"$ref":"#/components/responses/error404"},"422":{"$ref":"#/components/responses/error422"},"500":{"$ref":"#/components/responses/error500"}},"summary":"Get templates","tags":["Templates"],"x-code-samples":[{"lang":"Shell + Curl","source":"curl --request GET \\\n --url https://us1.pdfgeneratorapi.com/api/v3/templates \\\n --header 'authorization: Bearer REPLACE_BEARER_TOKEN'"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://us1.pdfgeneratorapi.com/api/v3/templates\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => array(\n \"authorization: Bearer REPLACE_BEARER_TOKEN\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"},{"lang":"Csharp + Restsharp","source":"var client = new RestClient(\"https://us1.pdfgeneratorapi.com/api/v3/templates\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\");\nIRestResponse response = client.Execute(request);"},{"lang":"Java + Unirest","source":"HttpResponse<String> response = Unirest.get(\"https://us1.pdfgeneratorapi.com/api/v3/templates\")\n .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n .asString();"},{"lang":"Node + Native","source":"var http = require(\"https\");\n\nvar options = {\n \"method\": \"GET\",\n \"hostname\": \"us1.pdfgeneratorapi.com\",\n \"port\": null,\n \"path\": \"/api/v3/templates\",\n \"headers\": {\n \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n }\n};\n\nvar req = http.request(options, function (res) {\n var chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.end();"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"us1.pdfgeneratorapi.com\")\n\nheaders = { 'authorization': \"Bearer REPLACE_BEARER_TOKEN\" }\n\nconn.request(\"GET\", \"/api/v3/templates\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Ruby + Native","source":"require 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nurl = URI(\"https://us1.pdfgeneratorapi.com/api/v3/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'Bearer REPLACE_BEARER_TOKEN'\n\nresponse = http.request(request)\nputs response.read_body"}]},"post":{"description":"Creates a new template. If template configuration is not specified in the request body then an empty template is created. Template is placed to the workspace specified in authentication params. Template configuration must be sent in the request body.","operationId":"createTemplate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDefinitionNew"}}},"description":"Template configuration as JSON string","required":true},"responses":{"200":{"$ref":"#/components/responses/templateConfig"},"401":{"$ref":"#/components/responses/error401"},"403":{"$ref":"#/components/responses/error403"},"404":{"$ref":"#/components/responses/error404"},"422":{"$ref":"#/components/responses/error422"},"500":{"$ref":"#/components/responses/error500"}},"summary":"Create template","tags":["Templates"],"x-code-samples":[{"lang":"Shell + Curl","source":"curl --request POST \\\n --url https://us1.pdfgeneratorapi.com/api/v3/templates \\\n --header 'authorization: Bearer REPLACE_BEARER_TOKEN' \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"Invoice template\",\"tags\":[\"invoice\",\"orders\"],\"isDraft\":true,\"layout\":{\"format\":\"A4\",\"width\":21,\"height\":29.7,\"unit\":\"cm\",\"orientation\":\"portrait\",\"rotaion\":0,\"margins\":{\"top\":0.5,\"right\":0.5,\"bottom\":0.5,\"left\":0.5},\"repeatLayout\":{\"format\":\"A4\",\"width\":21,\"height\":29.7},\"emptyLabels\":0},\"pages\":[{\"width\":21,\"height\":29.7,\"margins\":{\"right\":0.5,\"bottom\":0.5},\"components\":[{\"cls\":\"labelComponent\",\"id\":\"component-12313\",\"width\":3.5,\"height\":1,\"top\":4.2,\"left\":2.5,\"zindex\":102,\"value\":\"${price}\",\"dataIndex\":\"line_items\"}]}]}'"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://us1.pdfgeneratorapi.com/api/v3/templates\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\",\n CURLOPT_HTTPHEADER => array(\n \"authorization: Bearer REPLACE_BEARER_TOKEN\",\n \"content-type: application/json\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"},{"lang":"Csharp + Restsharp","source":"var client = new RestClient(\"https://us1.pdfgeneratorapi.com/api/v3/templates\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"Java + Unirest","source":"HttpResponse<String> response = Unirest.post(\"https://us1.pdfgeneratorapi.com/api/v3/templates\")\n .header(\"content-type\", \"application/json\")\n .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n .body(\"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\")\n .asString();"},{"lang":"Node + Native","source":"var http = require(\"https\");\n\nvar options = {\n \"method\": \"POST\",\n \"hostname\": \"us1.pdfgeneratorapi.com\",\n \"port\": null,\n \"path\": \"/api/v3/templates\",\n \"headers\": {\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n }\n};\n\nvar req = http.request(options, function (res) {\n var chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.write(JSON.stringify({\n name: 'Invoice template',\n tags: ['invoice', 'orders'],\n isDraft: true,\n layout: {\n format: 'A4',\n width: 21,\n height: 29.7,\n unit: 'cm',\n orientation: 'portrait',\n rotaion: 0,\n margins: {top: 0.5, right: 0.5, bottom: 0.5, left: 0.5},\n repeatLayout: {format: 'A4', width: 21, height: 29.7},\n emptyLabels: 0\n },\n pages: [\n {\n width: 21,\n height: 29.7,\n margins: {right: 0.5, bottom: 0.5},\n components: [\n {\n cls: 'labelComponent',\n id: 'component-12313',\n width: 3.5,\n height: 1,\n top: 4.2,\n left: 2.5,\n zindex: 102,\n value: '${price}',\n dataIndex: 'line_items'\n }\n ]\n }\n ]\n}));\nreq.end();"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"us1.pdfgeneratorapi.com\")\n\npayload = \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\"\n\nheaders = {\n 'content-type': \"application/json\",\n 'authorization': \"Bearer REPLACE_BEARER_TOKEN\"\n }\n\nconn.request(\"POST\", \"/api/v3/templates\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Ruby + Native","source":"require 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nurl = URI(\"https://us1.pdfgeneratorapi.com/api/v3/templates\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"content-type\"] = 'application/json'\nrequest[\"authorization\"] = 'Bearer REPLACE_BEARER_TOKEN'\nrequest.body = \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\"\n\nresponse = http.request(request)\nputs response.read_body"}]}},"/templates/output":{"post":{"description":"Allows to merge multiples template with data and returns base64 encoded document or public URL to a document. NB! When the public URL option is used, the document is stored for 30 days and automatically deleted.","operationId":"mergeTemplates","parameters":[{"$ref":"#/components/parameters/doc_name"},{"$ref":"#/components/parameters/format"},{"$ref":"#/components/parameters/output"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchData"}}},"description":"Data used to specify templates and data objects which are used to merge the template","required":true},"responses":{"200":{"$ref":"#/components/responses/document"},"401":{"$ref":"#/components/responses/error401"},"403":{"$ref":"#/components/responses/error403"},"404":{"$ref":"#/components/responses/error404"},"422":{"$ref":"#/components/responses/error422"},"500":{"$ref":"#/components/responses/error500"}},"summary":"Generate document (multiple templates)","tags":["Documents"],"x-code-samples":[{"lang":"Shell + Curl","source":"curl --request POST \\\n --url 'https://us1.pdfgeneratorapi.com/api/v3/templates/output?name=My%20document&format=pdf&output=base64' \\\n --header 'authorization: Bearer REPLACE_BEARER_TOKEN' \\\n --header 'content-type: application/json' \\\n --data '[{\"template\":52272,\"data\":{\"key\":\"value\"}},{\"template\":52273,\"data\":{\"key2\":\"value2\"}}]'"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://us1.pdfgeneratorapi.com/api/v3/templates/output?name=My%20document&format=pdf&output=base64\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => \"[{\\\"template\\\":52272,\\\"data\\\":{\\\"key\\\":\\\"value\\\"}},{\\\"template\\\":52273,\\\"data\\\":{\\\"key2\\\":\\\"value2\\\"}}]\",\n CURLOPT_HTTPHEADER => array(\n \"authorization: Bearer REPLACE_BEARER_TOKEN\",\n \"content-type: application/json\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"},{"lang":"Csharp + Restsharp","source":"var client = new RestClient(\"https://us1.pdfgeneratorapi.com/api/v3/templates/output?name=My%20document&format=pdf&output=base64\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\");\nrequest.AddParameter(\"application/json\", \"[{\\\"template\\\":52272,\\\"data\\\":{\\\"key\\\":\\\"value\\\"}},{\\\"template\\\":52273,\\\"data\\\":{\\\"key2\\\":\\\"value2\\\"}}]\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"Java + Unirest","source":"HttpResponse<String> response = Unirest.post(\"https://us1.pdfgeneratorapi.com/api/v3/templates/output?name=My%20document&format=pdf&output=base64\")\n .header(\"content-type\", \"application/json\")\n .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n .body(\"[{\\\"template\\\":52272,\\\"data\\\":{\\\"key\\\":\\\"value\\\"}},{\\\"template\\\":52273,\\\"data\\\":{\\\"key2\\\":\\\"value2\\\"}}]\")\n .asString();"},{"lang":"Node + Native","source":"var http = require(\"https\");\n\nvar options = {\n \"method\": \"POST\",\n \"hostname\": \"us1.pdfgeneratorapi.com\",\n \"port\": null,\n \"path\": \"/api/v3/templates/output?name=My%20document&format=pdf&output=base64\",\n \"headers\": {\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n }\n};\n\nvar req = http.request(options, function (res) {\n var chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.write(JSON.stringify([\n {template: 52272, data: {key: 'value'}},\n {template: 52273, data: {key2: 'value2'}}\n]));\nreq.end();"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"us1.pdfgeneratorapi.com\")\n\npayload = \"[{\\\"template\\\":52272,\\\"data\\\":{\\\"key\\\":\\\"value\\\"}},{\\\"template\\\":52273,\\\"data\\\":{\\\"key2\\\":\\\"value2\\\"}}]\"\n\nheaders = {\n 'content-type': \"application/json\",\n 'authorization': \"Bearer REPLACE_BEARER_TOKEN\"\n }\n\nconn.request(\"POST\", \"/api/v3/templates/output?name=My%20document&format=pdf&output=base64\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Ruby + Native","source":"require 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nurl = URI(\"https://us1.pdfgeneratorapi.com/api/v3/templates/output?name=My%20document&format=pdf&output=base64\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"content-type\"] = 'application/json'\nrequest[\"authorization\"] = 'Bearer REPLACE_BEARER_TOKEN'\nrequest.body = \"[{\\\"template\\\":52272,\\\"data\\\":{\\\"key\\\":\\\"value\\\"}},{\\\"template\\\":52273,\\\"data\\\":{\\\"key2\\\":\\\"value2\\\"}}]\"\n\nresponse = http.request(request)\nputs response.read_body"}]}},"/templates/templateId":{"delete":{"description":"Deletes the template from workspace","operationId":"deleteTemplate","parameters":[{"description":"Template unique identifier","in":"query","name":"templateId","required":true,"schema":{"example":19375,"type":"integer"}}],"responses":{"200":{"$ref":"#/components/responses/success"},"401":{"$ref":"#/components/responses/error401"},"403":{"$ref":"#/components/responses/error403"},"404":{"$ref":"#/components/responses/error404"},"422":{"$ref":"#/components/responses/error422"},"500":{"$ref":"#/components/responses/error500"}},"summary":"Delete template","tags":["Templates"],"x-code-samples":[{"lang":"Shell + Curl","source":"curl --request DELETE \\\n --url https://us1.pdfgeneratorapi.com/api/v3/templates/templateId \\\n --header 'authorization: Bearer REPLACE_BEARER_TOKEN'"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => array(\n \"authorization: Bearer REPLACE_BEARER_TOKEN\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"},{"lang":"Csharp + Restsharp","source":"var client = new RestClient(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\");\nvar request = new RestRequest(Method.DELETE);\nrequest.AddHeader(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\");\nIRestResponse response = client.Execute(request);"},{"lang":"Java + Unirest","source":"HttpResponse<String> response = Unirest.delete(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\")\n .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n .asString();"},{"lang":"Node + Native","source":"var http = require(\"https\");\n\nvar options = {\n \"method\": \"DELETE\",\n \"hostname\": \"us1.pdfgeneratorapi.com\",\n \"port\": null,\n \"path\": \"/api/v3/templates/templateId\",\n \"headers\": {\n \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n }\n};\n\nvar req = http.request(options, function (res) {\n var chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.end();"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"us1.pdfgeneratorapi.com\")\n\nheaders = { 'authorization': \"Bearer REPLACE_BEARER_TOKEN\" }\n\nconn.request(\"DELETE\", \"/api/v3/templates/templateId\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Ruby + Native","source":"require 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nurl = URI(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"authorization\"] = 'Bearer REPLACE_BEARER_TOKEN'\n\nresponse = http.request(request)\nputs response.read_body"}]},"get":{"description":"Returns template configuration","operationId":"getTemplate","parameters":[{"description":"Template unique identifier","in":"query","name":"templateId","required":true,"schema":{"example":19375,"type":"integer"}}],"responses":{"200":{"$ref":"#/components/responses/templateConfig"},"401":{"$ref":"#/components/responses/error401"},"403":{"$ref":"#/components/responses/error403"},"404":{"$ref":"#/components/responses/error404"},"422":{"$ref":"#/components/responses/error422"},"500":{"$ref":"#/components/responses/error500"}},"summary":"Get template","tags":["Templates"],"x-code-samples":[{"lang":"Shell + Curl","source":"curl --request GET \\\n --url https://us1.pdfgeneratorapi.com/api/v3/templates/templateId \\\n --header 'authorization: Bearer REPLACE_BEARER_TOKEN'"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => array(\n \"authorization: Bearer REPLACE_BEARER_TOKEN\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"},{"lang":"Csharp + Restsharp","source":"var client = new RestClient(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\");\nIRestResponse response = client.Execute(request);"},{"lang":"Java + Unirest","source":"HttpResponse<String> response = Unirest.get(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\")\n .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n .asString();"},{"lang":"Node + Native","source":"var http = require(\"https\");\n\nvar options = {\n \"method\": \"GET\",\n \"hostname\": \"us1.pdfgeneratorapi.com\",\n \"port\": null,\n \"path\": \"/api/v3/templates/templateId\",\n \"headers\": {\n \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n }\n};\n\nvar req = http.request(options, function (res) {\n var chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.end();"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"us1.pdfgeneratorapi.com\")\n\nheaders = { 'authorization': \"Bearer REPLACE_BEARER_TOKEN\" }\n\nconn.request(\"GET\", \"/api/v3/templates/templateId\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Ruby + Native","source":"require 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nurl = URI(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'Bearer REPLACE_BEARER_TOKEN'\n\nresponse = http.request(request)\nputs response.read_body"}]},"put":{"description":"Updates template configuration. The template configuration for pages and layout must be complete as the entire configuration is replaced and not merged.","operationId":"updateTemplate","parameters":[{"description":"Template unique identifier","in":"query","name":"templateId","required":true,"schema":{"example":19375,"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDefinitionNew"}}},"description":"Template configuration as JSON string","required":true},"responses":{"200":{"$ref":"#/components/responses/templateConfig"},"401":{"$ref":"#/components/responses/error401"},"403":{"$ref":"#/components/responses/error403"},"404":{"$ref":"#/components/responses/error404"},"422":{"$ref":"#/components/responses/error422"},"500":{"$ref":"#/components/responses/error500"}},"summary":"Update template","tags":["Templates"],"x-code-samples":[{"lang":"Shell + Curl","source":"curl --request PUT \\\n --url https://us1.pdfgeneratorapi.com/api/v3/templates/templateId \\\n --header 'authorization: Bearer REPLACE_BEARER_TOKEN' \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"Invoice template\",\"tags\":[\"invoice\",\"orders\"],\"isDraft\":true,\"layout\":{\"format\":\"A4\",\"width\":21,\"height\":29.7,\"unit\":\"cm\",\"orientation\":\"portrait\",\"rotaion\":0,\"margins\":{\"top\":0.5,\"right\":0.5,\"bottom\":0.5,\"left\":0.5},\"repeatLayout\":{\"format\":\"A4\",\"width\":21,\"height\":29.7},\"emptyLabels\":0},\"pages\":[{\"width\":21,\"height\":29.7,\"margins\":{\"right\":0.5,\"bottom\":0.5},\"components\":[{\"cls\":\"labelComponent\",\"id\":\"component-12313\",\"width\":3.5,\"height\":1,\"top\":4.2,\"left\":2.5,\"zindex\":102,\"value\":\"${price}\",\"dataIndex\":\"line_items\"}]}]}'"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"PUT\",\n CURLOPT_POSTFIELDS => \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\",\n CURLOPT_HTTPHEADER => array(\n \"authorization: Bearer REPLACE_BEARER_TOKEN\",\n \"content-type: application/json\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"},{"lang":"Csharp + Restsharp","source":"var client = new RestClient(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\");\nvar request = new RestRequest(Method.PUT);\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\");\nrequest.AddParameter(\"application/json\", \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"lang":"Java + Unirest","source":"HttpResponse<String> response = Unirest.put(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\")\n .header(\"content-type\", \"application/json\")\n .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n .body(\"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\")\n .asString();"},{"lang":"Node + Native","source":"var http = require(\"https\");\n\nvar options = {\n \"method\": \"PUT\",\n \"hostname\": \"us1.pdfgeneratorapi.com\",\n \"port\": null,\n \"path\": \"/api/v3/templates/templateId\",\n \"headers\": {\n \"content-type\": \"application/json\",\n \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n }\n};\n\nvar req = http.request(options, function (res) {\n var chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.write(JSON.stringify({\n name: 'Invoice template',\n tags: ['invoice', 'orders'],\n isDraft: true,\n layout: {\n format: 'A4',\n width: 21,\n height: 29.7,\n unit: 'cm',\n orientation: 'portrait',\n rotaion: 0,\n margins: {top: 0.5, right: 0.5, bottom: 0.5, left: 0.5},\n repeatLayout: {format: 'A4', width: 21, height: 29.7},\n emptyLabels: 0\n },\n pages: [\n {\n width: 21,\n height: 29.7,\n margins: {right: 0.5, bottom: 0.5},\n components: [\n {\n cls: 'labelComponent',\n id: 'component-12313',\n width: 3.5,\n height: 1,\n top: 4.2,\n left: 2.5,\n zindex: 102,\n value: '${price}',\n dataIndex: 'line_items'\n }\n ]\n }\n ]\n}));\nreq.end();"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"us1.pdfgeneratorapi.com\")\n\npayload = \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\"\n\nheaders = {\n 'content-type': \"application/json\",\n 'authorization': \"Bearer REPLACE_BEARER_TOKEN\"\n }\n\nconn.request(\"PUT\", \"/api/v3/templates/templateId\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Ruby + Native","source":"require 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nurl = URI(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"content-type\"] = 'application/json'\nrequest[\"authorization\"] = 'Bearer REPLACE_BEARER_TOKEN'\nrequest.body = \"{\\\"name\\\":\\\"Invoice template\\\",\\\"tags\\\":[\\\"invoice\\\",\\\"orders\\\"],\\\"isDraft\\\":true,\\\"layout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7,\\\"unit\\\":\\\"cm\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"rotaion\\\":0,\\\"margins\\\":{\\\"top\\\":0.5,\\\"right\\\":0.5,\\\"bottom\\\":0.5,\\\"left\\\":0.5},\\\"repeatLayout\\\":{\\\"format\\\":\\\"A4\\\",\\\"width\\\":21,\\\"height\\\":29.7},\\\"emptyLabels\\\":0},\\\"pages\\\":[{\\\"width\\\":21,\\\"height\\\":29.7,\\\"margins\\\":{\\\"right\\\":0.5,\\\"bottom\\\":0.5},\\\"components\\\":[{\\\"cls\\\":\\\"labelComponent\\\",\\\"id\\\":\\\"component-12313\\\",\\\"width\\\":3.5,\\\"height\\\":1,\\\"top\\\":4.2,\\\"left\\\":2.5,\\\"zindex\\\":102,\\\"value\\\":\\\"${price}\\\",\\\"dataIndex\\\":\\\"line_items\\\"}]}]}\"\n\nresponse = http.request(request)\nputs response.read_body"}]}},"/templates/templateId/copy":{"post":{"description":"Creates a copy of a template to the workspace specified in authentication parameters.","operationId":"copyTemplate","parameters":[{"description":"Template unique identifier","in":"query","name":"templateId","required":true,"schema":{"example":19375,"type":"integer"}},{"description":"Name for the copied template. If name is not specified then the original name is used.","example":"My copied template","in":"query","name":"name","required":false,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/templateConfig"},"401":{"$ref":"#/components/responses/error401"},"403":{"$ref":"#/components/responses/error403"},"404":{"$ref":"#/components/responses/error404"},"422":{"$ref":"#/components/responses/error422"},"500":{"$ref":"#/components/responses/error500"}},"summary":"Copy template","tags":["Templates"],"x-code-samples":[{"lang":"Shell + Curl","source":"curl --request POST \\\n --url 'https://us1.pdfgeneratorapi.com/api/v3/templates/templateId/copy?name=SOME_STRING_VALUE' \\\n --header 'authorization: Bearer REPLACE_BEARER_TOKEN'"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId/copy?name=SOME_STRING_VALUE\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_HTTPHEADER => array(\n \"authorization: Bearer REPLACE_BEARER_TOKEN\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}"},{"lang":"Csharp + Restsharp","source":"var client = new RestClient(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId/copy?name=SOME_STRING_VALUE\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\");\nIRestResponse response = client.Execute(request);"},{"lang":"Java + Unirest","source":"HttpResponse<String> response = Unirest.post(\"https://us1.pdfgeneratorapi.com/api/v3/templates/templateId/copy?name=SOME_STRING_VALUE\")\n .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n .asString();"},{"lang":"Node + Native","source":"var http = require(\"https\");\n\nvar options = {\n \"method\": \"POST\",\n \"hostname\": \"us1.pdfgeneratorapi.com\",\n \"port\": null,\n \"path\": \"/api/v3/templates/templateId/copy?name=SOME_STRING_VALUE\",\n \"headers\": {\n \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n }\n};\n\nvar req = http.request(options, function (res) {\n var chunks = [];\n\n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n\n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n});\n\nreq.end();"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"us1.pdfgeneratorapi.com\")\n\nheaders = { 'authorization': \"Bearer REPLACE_BEARER_TOKEN\" }\n\nconn.request(\"POST\", \"/api/v3/templates/templateId/copy?name=SOME_STRING_VALUE\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Ruby + Native","source":"require 'uri'\nreq