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",
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
]
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
]
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.