MENU navbar-image

Introduction

This documentation provides a reference to the API endpoints, including example requests and responses.

If you have any questions or need help, please contact our support team. Support email: [email protected].

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Generate API token.

Attestation Requests

APIs for managing attestation requests.

Create a new attestation request.

requires authentication

You must provide the person_id and document_id in the request body.

Example request:
curl --request POST \
    "https://api.clearpolicy.app/api/v1/attestation-requests" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"person_id\": \"01kg82xqfx6fvr046d15hnfmjv\",
    \"document_id\": \"01kg82xqfx6fvr046d15hnfmjv\",
    \"requested_attestation_type\": \"acknowledgment\"
}"
const url = new URL(
    "https://api.clearpolicy.app/api/v1/attestation-requests"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "person_id": "01kg82xqfx6fvr046d15hnfmjv",
    "document_id": "01kg82xqfx6fvr046d15hnfmjv",
    "requested_attestation_type": "acknowledgment"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
  "id": "01kg82xqfx6fvr046d15hnfmjv",
  "organization_id": "01kg82xqfx6fvr046d15hnfmjv",
  "document_revision_id": "01kg82xqfx6fvr046d15hnfmjv",
  "person_id": "01kg82xqfx6fvr046d15hnfmjv",
  "sent_at": "2024-01-01T00:00:00.000000Z",
  "requested_attestation_type": "signature",
  "viewed_at": null,
  "attested_at": null,
  "canceled_at": null,
  "requested_by_user_id": "01kg82xqfx6fvr046d15hnfmjv",
  "batch_id": null,
  "created_at": "2024-01-01T00:00:00.000000Z",
  "updated_at": "2024-01-01T00:00:00.000000Z",
  "status": "sent",
 }
 

Request      

POST api/v1/attestation-requests

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

person_id   string     

The unique identifier of the person to send the attestation request to. Example: 01kg82xqfx6fvr046d15hnfmjv

document_id   string     

The unique identifier of the document to be attested. Example: 01kg82xqfx6fvr046d15hnfmjv

requested_attestation_type   string  optional    

Example: acknowledgment

Must be one of:
  • acknowledgment
  • signature

Documents

APIs for managing documents.

List all documents.

requires authentication

You can filter documents by providing query parameters such as name.

Example request:
curl --request GET \
    --get "https://api.clearpolicy.app/api/v1/documents?name=Employee+Handbook" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.clearpolicy.app/api/v1/documents"
);

const params = {
    "name": "Employee Handbook",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


[
    {
        "id": "01kg82xqfx6fvr046d15hnfmjv",
        "organization_id": "01kg82xqfx6fvr046d15hnfmjv",
        "name": "Employee Handbook",
        "created_at": "2024-01-01T00:00:00.000000Z",
        "updated_at": "2024-01-01T00:00:00.000000Z",
        "has_published_revision": true,
        "last_updated_at": "2024-01-01T00:00:00.000000Z"
    },
    {
        "id": "05ns89asd87fsdg045g45hnfskd",
        "organization_id": "01kg82xqfx6fvr046d15hnfmjv",
        "name": "Code of Conduct",
        "created_at": "2024-01-02T00:00:00.000000Z",
        "updated_at": "2024-01-02T00:00:00.000000Z",
        "has_published_revision": false,
        "last_updated_at": "2024-01-02T00:00:00.000000Z"
    }
]
 

Request      

GET api/v1/documents

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

name   string  optional    

The name of the document. Example: Employee Handbook

Endpoints

Retrieve current user.

requires authentication

This endpoint returns the details of the currently authenticated user, including their name, email, and the name of the organization they belong to.

Example request:
curl --request GET \
    --get "https://api.clearpolicy.app/api/v1/me" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.clearpolicy.app/api/v1/me"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "id": "01kg82xqfx6fvr046d15hnfmjv",
    "name": "John Doe",
    "email": "[email protected]",
    "current_organization_name": "Example Organization"
}
 

Request      

GET api/v1/me

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

People

APIs for managing people.

List all people.

requires authentication

You can filter people by providing query parameters such as id, name, email, or phone.

Example request:
curl --request GET \
    --get "https://api.clearpolicy.app/api/v1/people?id=01kg82xqfx6fvr046d15hnfmjv&name=John+Doe&email=john.doe%40example.com&phone=%2B12345678901&archived=architecto" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.clearpolicy.app/api/v1/people"
);

const params = {
    "id": "01kg82xqfx6fvr046d15hnfmjv",
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "+12345678901",
    "archived": "architecto",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


[
    {
        "id": "01kg82xqfx6fvr046d15hnfmjv",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "+12345678901"
    },
    {
        "id": "05ns89asd87fsdg045g45hnfskd",
        "name": "Jane Smith",
        "email": "[email protected]",
        "phone": "+12345678902"
    }
]
 

Request      

GET api/v1/people

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

id   string  optional    

The unique identifier of the person. Example: 01kg82xqfx6fvr046d15hnfmjv

name   string  optional    

The name of the person. Example: John Doe

email   string  optional    

The email address of the person. Example: [email protected]

phone   string  optional    

The phone number of the person. Must be in international format. Example: +12345678901

archived   string  optional    

Example: architecto

Create a new person.

requires authentication

You must provide the name and email of the person. The phone number is optional but must be in international format if provided.

Example request:
curl --request POST \
    "https://api.clearpolicy.app/api/v1/people" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"John Doe\",
    \"email\": \"[email protected]\",
    \"phone\": \"+12345678901\",
    \"groups\": [
        \"n\"
    ],
    \"documents\": [
        \"architecto\"
    ]
}"
const url = new URL(
    "https://api.clearpolicy.app/api/v1/people"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "+12345678901",
    "groups": [
        "n"
    ],
    "documents": [
        "architecto"
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "id": "01kg82xqfx6fvr046d15hnfmjv",
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "+12345678901"
}
 

Request      

POST api/v1/people

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string     

The name of the person. Example: John Doe

email   string     

The email address of the person. Example: [email protected]

phone   string  optional    

The phone number of the person. Must be in international format. Example: +12345678901

groups   string[]  optional    

Must not be greater than 255 characters.

documents   string[]  optional    

Retrieve the specified person.

requires authentication

You can retrieve a person by its unique identifier (ID). The response will include the person's name, email, and phone number.

Example request:
curl --request GET \
    --get "https://api.clearpolicy.app/api/v1/people/01kkn48q1cvh6xerxhfxdy2zpe" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.clearpolicy.app/api/v1/people/01kkn48q1cvh6xerxhfxdy2zpe"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "id": "01kg82xqfx6fvr046d15hnfmjv",
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "+12345678901"
}
 

Request      

GET api/v1/people/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   string     

The ID of the person. Example: 01kkn48q1cvh6xerxhfxdy2zpe