ENGAGE HELP CENTER
Consent PDF export
This guide explains how to download and save all consent PDFs from the Longenesis.Engage platform.
Overview

Retrieving signed consent documents requires three steps:
1. Authentication with Longenesis Auth service
2. Retrieving a list of all consent submissions to get submission IDs
3. Downloading individual consent PDFs using those IDs
Prerequisites

- Python 3.6 or higher
- requests library (pip install requests)
- Valid Longenesis API credentials
Contact support@longenesis.com to get access credentials.
Complete Example

import requests

AUTH_ENDPOINT = "https://auth.longenesis.com/realms/curator-engage/protocol/openid-connect/token"
USERNAME = "<your username>"
PASSWORD = "<your password>"
CLIENT_ID = "<Longenesis issued client id>"
CLIENT_SECRET = "<Longenesis issued client id>"

ORG_SLUG = "<orgagization slug>"
PROJECT_SLUG = "<activity slug>"
ACTIVITY_SLUG = "<activity slug>"

access_token = requests.post(
    AUTH_ENDPOINT,
    data={
        "username": USERNAME,
        "password": PASSWORD,
        "grant_type": "password",
        "client_id": CLIENT_ID,
        "client_secret": CLIENT_SECRET,
    },
).json()["access_token"]

# Get a list all submissions to the consent activity (up to 5000 in one request).
response = requests.get(
    f"https://engage-openapi.longenesis.com/v2/json_answers/{ORG_SLUG}",
    params={
        "activity_filter": ACTIVITY_SLUG,
        "date_filter": ["2025-01-01", "2025-01-31"],
    },
    headers={"Authorization": f"Bearer {access_token}"},
)

for record in response.json()["records"]:
    submission_id = record["submission_id"]

    response2 = requests.get(
        f"https://engage-openapi.longenesis.com/pdf/{ORG_SLUG}/{PROJECT_SLUG}/{ACTIVITY_SLUG}/{submission_id}/admin_download",
        headers={"Authorization": f"Bearer {access_token}"},
    )
    with open(f"consent_file_{submission_id}.pdf", "wb") as f:
        f.write(response2.content)
In the example, replace the following elements with information from Engage:
- ORG_SLUG - slug of your Engage organisation.
- PROJECT_SLUG - the slug of the project where the consents are gathered.
- ACTIVITY_SLUG - the slug of the consent activity.
The ORG_SLUG element can be found in the Engage section My organisation.

To find the ORG_SLUG element follow the below steps.
1. Log into the Engage platform.
2. Go to the section My organisation in Settings.
3. Navigate to the section Slug for your organisation invitation link.
4. Obtain the ORG_SLUG from the organisation link displayed. It is the last element of the link.
The PROJECT_SLUG element can be found in the Public sharing section of the Engage project.

To find the PROJECT_SLUG element follow the below steps.
1. Log into the Engage platform,
2. In the section Manage projects find the project where the consent activity is located.
3. Click on the three vertical dots on the card of the specific project and select Public sharing,
4. Obtain the activity slug from the very end of the Public link of the project.
The ACTIVITY_SLUG element can be found in the Public sharing section of the Engage activity.

To find the ENGAGE_ACTIVITY_SLUG element follow the below steps.
1. Log into the Engage platform,
2. Click the button View activities on the Engage project where the consent activity is located,
3. Click on the three vertical dots on the card of the specific activity and select Public sharing,
4. Obtain the activity slug from the very end of the Public link of the activity.
Our team is ready to provide you assistance in any of the steps and would gladly guide you through the process.

Do not hesitate to contact us via support@longenesis.com if you have any questions or any help is required.
We use cookies in order to secure and improve the Longenesis web page functionality, as well as to optimize your experience within this page.
Please see our Privacy policy for more information on how we use the information about your use of our web page. By continuing to use this web page you agree to our Privacy Policy.