API Documentation

Using the Woodpecker API

Eszter Takacs avatar
Written by Eszter Takacs
Updated over a week ago

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,
folder_path: "/Client Docs"
  },
  {
    file_name: "My document 2",
    id: "5137497f-9e00-4487-a72e-cd0d1610c9bc.docx",
    is_owner: true,
folder_path: "/"
  },
  {
    file_name: "My document 3",
    id: "ada0eed3-7299-498c-8bdb-95713cf14cf8.docx",
    is_owner: false,
folder_path: "/"
  }
]


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. To receive a list of all fields in a set of documents (regardless of their types), you must pass the include_all_field_data parameter with your call (scroll down for more info).

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> }
]
}

Additionally, an optional parameter, "include_all_field_data", can be added to this request. When this flag is included with the boolean value true, all of the field data will be included in the unique_fields_and_types object with the key metadata. Additionally, all fields regardless of field type will be included in the response. Please see below for a sample request and response:

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"
],
"include_all_field_data": true
}

Example response:

{
document_fields: [
{
id: "386265a7-1fac-499e-851c-eb449fe0df95.docx",
name: "My Document 1",
fields: {
"field1",
"field2"
}
}
],
unique_fields: [
"field1",
"field2"
],
unique_fields_and_types: [
{ name: 'field1', type: <fieldType>, metadata: <all field data> },
{ name: 'field2', type: <fieldType>, metadata: <all field data> }
]
}

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
}

GET /submissions

This endpoint returns a list of all the Woodpecker questionnaire submissions submitted in the last hour.

Example request:

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

Example response:

[
{
"id":"<id-1>",
"questionnaireId": <id of questionnaire>,
"questionnaireName": <name of questionnaire>,
"submitterEmail": <email address of questionnaire submitter>,
"zipLink":"<url>",
"csvLink":"<url>",
"fileNames":"<list of file names in zip file>",
"responses": <list of questionnaire responses>
},
{
"id":"<id-2>",
"questionnaireId": <id of questionnaire>,
"questionnaireName": <name of questionnaire>,
"submitterEmail": <email address of questionnaire submitter>,
"zipLink":"<url>",
"csvLink":"<url>",
"fileNames":"<list of file names in zip file>",
"responses": <list of questionnaire responses>
},
{
"id":"<id-3>",
"questionnaireId": <id of questionnaire>,
"questionnaireName": <name of questionnaire>,
"submitterEmail": <email address of questionnaire submitter>,
"zipLink":"<url>",
"csvLink":"<url>",
"fileNames":"<list of file names in zip file>",
"responses": <list of questionnaire responses>
]

POST /data_management

This endpoint takes in a client email address and either creates a new client record

or updates an existing one. The client record requires an email address to identify

the client, a key-value pair of the record to be created/updated, and a type for the field. The key should be the field name, while the value should be the data input for the field. The type you supply should match one of the available types of Woodpecker fields.

Available field types include: "TEXT", "MULTILINE_TEXT", "TEXT_BOX", "DATE", "NUMBER", "SINGLE_SELECT", "MULTI_SELECT"

Example request:

POST https://api.c.woodpeckerweb.com/v1/data_management
Header: "x-api-key:<your API key>"
Body:
{
"email": "name@email.com",
"fields": [
{
"name": "Sample Field Name",
"value": "Sample Field Value",
"type": "TEXT"
}
]
}

Example response:

{
"success"
}

Did this answer your question?