Upload New Template

Upload a new PDF Template

HTTP Request

POST https://api.docspring.com/api/v1/templates

You must make a multipart/form-data form post. The following form params are required:

  • template[document] - The PDF file data
  • template[name] - The name of your new PDF template

The following form params are optional:

  • template[parent_folder_id] - The folder id that you want PDF template to be created under

Authentication

You must send an Authorization header with the value Basic followed by base 64 encoded token_id:token_secret.

For example: Authorization: Basic dG9rZW5faWQ6dG9rZW5fc2VjcmV0Cg==

See the Authentication documentation for more information.

Example Code

var DocSpring = require("docspring");

var config = new DocSpring.Configuration();
config.apiTokenId = "DOCSPRING_TOKEN_ID";
config.apiTokenSecret = "DOCSPRING_TOKEN_SECRET";
client = new DocSpring.Client(config);

var fs = require("fs");
var templateDocument = fs.createReadStream("path/to/your/pdf_document.pdf"); // File |
var templateName = "New Template Name"; // String |
var parentFolderId = null;
instance.createTemplate(
  templateDocument,
  templateName,
  parentFolderId,
  function(error, template) {
    if (error) throw error;
    console.log(template.id, template.name, template.document_url);
  }
);
using System;
using System.Diagnostics;
using DocSpring.Client.Api;
using DocSpring.Client.Client;
using DocSpring.Client.Model;

namespace Example
{
    public class DocSpringExample
    {
        public void main()
        {
          Configuration.Default.Username = "DOCSPRING_TOKEN_ID";
          Configuration.Default.Password = "DOCSPRING_TOKEN_SECRET";

          var apiInstance = new PDFApi();
          Stream templateDocument = File.OpenRead("path/to/your/document.pdf");
          string templateName = "Your Template Name";
          var pendingTemplate = instance.CreateTemplate(templateDocument, templateName);

          Debug.WriteLine(pendingTemplate.Id);
          Debug.WriteLine(pendingTemplate.Name);
        }
    }
}

results matching ""

    No results matching ""