PactSafe

The PactSafe Developer Hub

Welcome to the PactSafe developer hub. You'll find comprehensive guides and documentation to help you start working with PactSafe as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Retrieving Activity Data in Bulk

Today, there are a few available options for retrieving bulk Activity of data from the PactSafe platform outside of our web application. While reviewing these options, please keep in mind that we encourage you to limit your use of these routes to what is absolutely necessary. If you have more sophisticated or complex needs, please reach out to our support team for additional information on other methods that may be available.

REST API - Tasks Route

Our REST API provides a /tasks route that allows you to programmatically trigger the initiation of generating a CSV export of Activity data.

How
When using the /tasks/export/activity route, you are able to export activity data to a CSV asynchronously and retrieve the link(s) to the exported CSV by checking the status of the export with an ID generated upon creating the Task.

For example, your overall flow would look something like this:

Tasks Process Overview

Tasks Process Overview

When the export has completed successfully, you’ll see a property links that contains links to the CSV(s) available for download.

Starting the Export

Below, we’ll cover some key concepts when using this route—which we highly recommend reading through to ensure the exports are successful.

Filtering
When generating the export, you may want to limit the amount of data that is returned. To do this, you can supply a filter parameter that can limit the scope of the query on Activity data. Utilizing this is highly recommended in high-volume environments.

Example: https://api.pactsafe.com/v1.1/tasks/export/activity?filter=created_time>=2020-10-10 and event_type==agreed

The above API call when generating the export will only look for Activities that occurred after the specified date and are only agreed events.

Specifying Fields
Additionally, when generating the export, you may want to specify the columns data that gets returned in the CSV. Doing this requires adding a fields parameter with the field names you want to return. The fields id, signer_id, created_time should always be included in your call. If I wanted to specify additional fields like the IP Address, Page Title of the acceptance and a custom data field that I’ve previously used named VIP, my fields parameter and value would look like this: fields=id,signer_id,created_time,connection_data.remote_address,connection_data.page_title,custom_data.vip

This will result in the CSV having column headers that appear like the following:

id
signer_id
created_time
connection_data.remote_address
connection_data.page_title
custom_data.vip

5f88980b5944913d477c6dce

123

2020-10-15T18:42:19.689Z

1.1.1.1

My Page

TRUE

Note: not sure which fields are available or used on your site? Make the following call to retrieve the list by doing a GET on https://api.pactsafe.com/v1.1/sites/:id/exportFields

Full POST Example

https://api.pactsafe.com/v1.1/tasks/export/activity?filter=created_time>=2020-10-10 and event_type==agreed&fields=id,signer_id,created_time,connection_data.remote_address,connection_data.page_title,custom_data.vip&no_count=true&lean=true

View API Reference documentation for more information.

Example Response

{
    "data": {
        "status": "pending",
        "source": "api",
        "retry_count": 0,
        "active": true,
        "job_name": "GenerateExportCSV",
        "created_by": 9785,
        "account": 2785,
        "site": 5193,
        "data": {
            "exportName": "action",
            "exportType": "Action",
            "sendTo": "[email protected]"
        }
        "id": "5f88abf5f4689d7295cf1134"
    }
}

Retrieving Job Data and CSV

With the POST response, you’ll need to use the id property and use it to retrieve the status by doing a GET on the following: https://api.pactsafe.com/v1.1/tasks/export/:id which tells you the current status of the job and if it has successfully finished, it will provide the link(s) to the CSV (can contain multiple links depending on volume).

View API Reference documentation for more information.

Automatic Deletion

Please note that these CSVs are automatically deleted after 30 days.

REST API - Activity Route

Additionally, with our REST API, you can all retrieve “list” Activity of Signers within PactSafe using the /activity route. This is the easiest way to get data from the PactSafe platform but we also strongly recommended working with your PactSafe Customer Success Manager on ensuring the best query is made when using this route.

How
When using the /activity route, you can grab the data and utilize a couple of parameters that help reduce and filter data. For example, you can make the following API call to retrieve Agreed Activity events that were created after or equal to the specified date:
https://api.pactsafe.com/v1.1/filter=event_type==agreed and created_time>=2020-10-14&no_count=true&lean=true

Additionally, a no_count parameter that is equal to true and a lean parameter equal to true is used to reduce overhead and overall payload size.

S3 Nightly Export

Not Available for All Plans

This option may not be included in all plans. Please check with your Customer Success Manager.

Lastly, we offer an S3 bucket with activity data exported on a nightly basis with your account. This is the least configurable option but gives you the flexibility to access the data within an S3 bucket, which may be beneficial for your needs. When going this route, every night, your previous day’s activity will be exported to PDFs and optionally JSON (if enabled by your Customer Success Manager). At this time, these are the only export options available and there’s no way to turn off PDF generation. Additionally, every activity is exported to its own JSON file but is labeled in the following convenient format: record-activityId-UTCTimetamp, which gives you parseable information on the record.

How
This option requires being set up by your Customer Success Manager and your CSM will need to know if you want JSON exports enabled as well.

Updated about a month ago


Retrieving Activity Data in Bulk


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.