REST API: GET documents (Publisher)

You can use the REST API to retrieve all emailing documents for an account with an HTTP GET call to the following URL:

Available parameters

The following parameters are available for this call:

  • archived: Boolean that indicates whether to only include archived documents (true) or only documents that are not archived (false). Returns both by default.
  • source: Boolean that indicates whether to include the HTML source. This is set to 'true' by default, but the call can be executed faster when set to 'false'.
  • modifiedfromdate: Date after which the documents should have been modified in YYYY-MM-DD HH:MM:SS format.
  • modifiedtodate: Date before which the documents should have been modified in YYYY-MM-DD HH:MM:SS format.

Paging parameters start, limit and total are also supported. More information about these parameters can be found in the article on paging.

Returned fields

The method returns a JSON object where the *data field contains an array with emailing documents. Each document contains the following information:

  • id: The ID of the document.
  • template: The ID of the corresponding template.
  • name: The name of the document.
  • from_address: The from address for the document.
  • subject: The subject of the document.
  • archived: The archive status of the document. (1 for archived, null for not archived)
  • source: The source of the document.

JSON example

The JSON for the document might look something like this:

   "from_address":"\"test\" <>",

PHP example

The script below demonstrates how to use this API method.

// dependencies

// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);

// parameters for the call (exclude archived documents)
$params = array(
    'archived'  => false

// execute the call
print_r($api->get("publisher/documents", $params));

This example requires the REST API class

More information