GET /document_collection

This endpoint returns a list of all of the documents in your Woodpecker Document Collection.

Example request:

GET https://api.c.woodpeckerweb.com/v1/document_collection 
Header: "x-api-key:<your API key>"

Example response:

[
  {
    file_name: "My document 1",
    id: "386265a7-1fac-499e-851c-eb449fe0df95.docx",
    is_owner: true
  },
  {
    file_name: "My document 2",
    id: "5137497f-9e00-4487-a72e-cd0d1610c9bc.docx",
    is_owner: true
  },
  {
    file_name: "My document 3",
    id: "ada0eed3-7299-498c-8bdb-95713cf14cf8.docx",
    is_owner: false
  }
]


POST /document_fields

This endpoint takes in a list of document IDs corresponding to documents in your Document Collection. These IDs can be retrieved by calling the /document_collection  endpoint. This endpoint returns a collection of the document IDs that were supplied alongside the list of fields that are in each document. This endpoint also returns a list of unique fields (as well as unique fields and field types) across all of the documents that are supplied in the request payload.

NOTE: only fields requiring user input will be returned alongside each document. This excludes Conditional fields, Formula fields, and any "Excluded" fields.

Example request:

POST https://api.c.woodpeckerweb.com/v1/document_fields 
Header: "x-api-key:<your API key>"
Body:
{
  document_ids: [
    "386265a7-1fac-499e-851c-eb449fe0df95.docx",
    "5137497f-9e00-4487-a72e-cd0d1610c9bc.docx",
    "ada0eed3-7299-498c-8bdb-95713cf14cf8.docx",
  ]
}

Example response:

{
  document_fields: [
    {
      id: "386265a7-1fac-499e-851c-eb449fe0df95.docx",
      name: "My Document 1",
      fields: {
        "field1",
        "field2"
      }
    },
    {
      id: "5137497f-9e00-4487-a72e-cd0d1610c9bc.docx",
      name: "My Document 2",
      fields: {
        "fieldA",
        "fieldB"
      }
    },
    {
      id: "ada0eed3-7299-498c-8bdb-95713cf14cf8.docx",
      name: "My Document 3",
      fields: {
        "field3",
        "field4"
      }
    }
  ],
  unique_fields: [
    "field1",
    "field2",
    "field3",
    "field4",
    "fieldA",
    "fieldB"
  ],
unique_fields_and_types: [
{ name: 'field1', type: <fieldType> },
{ name: 'field2', type: <fieldType> },
{ name: 'field3', type: <fieldType> },
{ name: 'field4', type: <fieldType> },
{ name: 'fieldA', type: <fieldType> },
{ name: 'fieldB', type: <fieldType> }
]
}

POST /populate

This endpoint takes a list of document IDs (must be document IDs corresponding to documents in your Document Collection) and a list of fields with values for each document. The endpoint will populate each document with the field values that you send and will respond with a link to a zip folder containing all of the populated documents.

Example request:

POST https://api.c.woodpeckerweb.com/v1/populate 
Header: "x-api-key:<your API key>"
Body:
{
  document_fields: {
    "386265a7-1fac-499e-851c-eb449fe0df95.docx": {
      "field1": "John Smith"
    },
    "5137497f-9e00-4487-a72e-cd0d1610c9bc.docx": {
      "field1": "John Smith",
      "field2": "Company Name, Inc.",
      "field3": "My field value",
    },
    "ada0eed3-7299-498c-8bdb-95713cf14cf8.docx": {
      "field1": "John Smith"
    }
  }
}

Example response:

{
  zip_link: "<link to zip folder containing populated documents>"
}

Saving as PDF:

You may pass a pdf: true parameter with the /populate  payload to have your populated documents saved as PDFs. If this optional pdf  parameter is left out, the documents will be saved as .docx files. An example is below:

POST https://api.c.woodpeckerweb.com/v1/populate 
Header: "x-api-key:<your API key>"
Body:
{
  document_fields: {
    "386265a7-1fac-499e-851c-eb449fe0df95.docx": {
      "field1": "John Smith"
    },
    "5137497f-9e00-4487-a72e-cd0d1610c9bc.docx": {
      "field1": "John Smith",
      "field2": "Company Name, Inc.",
      "field3": "My field value",
    },
    "ada0eed3-7299-498c-8bdb-95713cf14cf8.docx": {
      "field1": "John Smith"
    }
  },
  pdf: true
}

Did this answer your question?