MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

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

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

You can generate an API token by visiting your settings page.

Endpoints

Get the list of all accounts you have access to

requires authentication

Example request:
curl --request GET \
    --get "https://aircall.postcall.io/api/accounts" \
    --header "Authorization: Bearer {API_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
 

[
    {
        "id": 1,
        "name": "Postcall Demo Account",
        "created_at": "2023-04-30T11:24:04.000000Z",
        "updated_at": "2023-05-30T11:24:19.000000Z"
    }
]
 

Request   

GET /accounts

Headers

Authorization      

Example: Bearer {API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Get a single account

requires authentication

Example request:
curl --request GET \
    --get "https://aircall.postcall.io/api/accounts/1" \
    --header "Authorization: Bearer {API_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
 

{
    "id": 1,
    "name": "Postcall Demo Account",
    "created_at": "2023-04-30T11:24:04.000000Z",
    "updated_at": "2023-05-30T11:24:19.000000Z"
}
 

Request   

GET /accounts/{account_id}

Headers

Authorization      

Example: Bearer {API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

account_id   integer   

The ID of the account. Example: 1

Get all surveys of the specified account

requires authentication

Example request:
curl --request GET \
    --get "https://aircall.postcall.io/api/accounts/1/surveys" \
    --header "Authorization: Bearer {API_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 57
 

[
    {
        "id": 1,
        "name": "CSAT Survey",
        "url": null,
        "questions": [
            {
                "id": 1,
                "question": "How did we do today?",
                "question_type": "csat-5-emoji",
                "required": true
            },
            {
                "id": 2,
                "question": "Any other comments?",
                "question_type": "longtext",
                "required": false
            }
        ]
    },
    {
        "id": 2,
        "name": "NPS Survey",
        "url": null,
        "questions": [
            {
                "id": 3,
                "question": "How likely are you to recommend us to a friend?",
                "question_type": "nps",
                "required": true
            },
            {
                "id": 4,
                "question": "Any other comments?",
                "question_type": "longtext",
                "required": false
            }
        ]
    }
]
 

Request   

GET /accounts/{account_id}/surveys

Headers

Authorization      

Example: Bearer {API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

account_id   integer   

The ID of the account. Example: 1

Get a single survey of the specified account

requires authentication

Example request:
curl --request GET \
    --get "https://aircall.postcall.io/api/accounts/1/surveys/1" \
    --header "Authorization: Bearer {API_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 56
 

{
    "id": 1,
    "name": "CSAT Survey",
    "url": null,
    "questions": [
        {
            "id": 1,
            "question": "How did we do today?",
            "question_type": "csat-5-emoji",
            "required": true
        },
        {
            "id": 2,
            "question": "Any other comments?",
            "question_type": "longtext",
            "required": false
        }
    ]
}
 

Request   

GET /accounts/{account_id}/surveys/{survey_id}

Headers

Authorization      

Example: Bearer {API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

account_id   integer   

The ID of the account. Example: 1

survey_id   integer   

The ID of the survey. Example: 1

Get the (paginated) results of the specified survey

requires authentication

Example request:
curl --request GET \
    --get "https://aircall.postcall.io/api/accounts/1/surveys/1/results?since=2023-05-01.&until=2023-05-09." \
    --header "Authorization: Bearer {API_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 55
 

{
    "data": [
        {
            "id": 1,
            "sent_at": "2023-05-30T11:24:04.000000Z",
            "answered_at": "2023-05-07T11:19:31.000000Z",
            "call": {
                "id": 1,
                "direction": "inbound",
                "source": "aircall",
                "source_external_id": "1",
                "duration_seconds": 0,
                "contact_phone_number": "+12725062076",
                "business_phone_number_id": "640126",
                "tags": null,
                "source_external_user_id": "1038829",
                "source_external_call_queue_id": null,
                "source_external_user_email": "phil@postcall.io",
                "source_external_user_name": "Phil Manavopoulos",
                "started_at": "2023-05-07T11:19:21.000000Z",
                "answered_at": "2023-05-07T11:19:24.000000Z",
                "source_external_asset": "https://example.com/1/recording"
            },
            "contact": {
                "id": 1,
                "source": "demo-seed",
                "source_external_id": "jackeline79@example.com",
                "subscribed": 1,
                "name": "Gussie Bednar",
                "unsubscribed_at": null,
                "unsubscribe_reason": null
            },
            "answers": [
                {
                    "id": 1,
                    "survey_question_id": 1,
                    "question": "How did we do today?",
                    "question_type": "csat-5-emoji",
                    "answer": "ok"
                },
                {
                    "id": 2,
                    "survey_question_id": 2,
                    "question": "Any other comments?",
                    "question_type": "longtext",
                    "answer": "Perspiciatis optio et voluptatem eveniet possimus aliquid. Laudantium sequi ut animi placeat ad autem recusandae."
                }
            ]
        },
        {
            "id": 5,
            "sent_at": "2023-05-30T11:24:04.000000Z",
            "answered_at": "2023-05-07T23:47:04.000000Z",
            "call": {
                "id": 5,
                "direction": "inbound",
                "source": "aircall",
                "source_external_id": "5",
                "duration_seconds": 520,
                "contact_phone_number": "+19738476153",
                "business_phone_number_id": "640126",
                "tags": null,
                "source_external_user_id": "1038829",
                "source_external_call_queue_id": null,
                "source_external_user_email": "phil@postcall.io",
                "source_external_user_name": "Phil Manavopoulos",
                "started_at": "2023-05-07T23:46:54.000000Z",
                "answered_at": "2023-05-07T23:46:57.000000Z",
                "source_external_asset": "https://example.com/5/recording"
            },
            "contact": {
                "id": 5,
                "source": "demo-seed",
                "source_external_id": "sschinner@example.org",
                "subscribed": 1,
                "name": "Stan Koelpin",
                "unsubscribed_at": null,
                "unsubscribe_reason": null
            },
            "answers": [
                {
                    "id": 5,
                    "survey_question_id": 1,
                    "question": "How did we do today?",
                    "question_type": "csat-5-emoji",
                    "answer": "good"
                },
                {
                    "id": 6,
                    "survey_question_id": 2,
                    "question": "Any other comments?",
                    "question_type": "longtext",
                    "answer": "Maxime culpa quod ipsum doloremque nihil repudiandae consequatur ex. Est unde dolor amet totam maiores."
                }
            ]
        }
    ],
    "path": "https://aircall.postcall.io/api/accounts/1/surveys/1/results",
    "per_page": 2,
    "next_cursor": "eyJzdXJ2ZXlfaW5zdGFuY2VzLmlkIjo1LCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9",
    "next_page_url": "https://aircall.postcall.io/api/accounts/1/surveys/1/results?per_page=2&since=2023-05-01T00%3A00%3A00%2B00%3A00&until=2023-05-09T00%3A00%3A00%2B00%3A00&cursor=eyJzdXJ2ZXlfaW5zdGFuY2VzLmlkIjo1LCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9",
    "prev_cursor": null,
    "prev_page_url": null
}
 

Request   

GET /accounts/{account_id}/surveys/{survey_id}/results

Headers

Authorization      

Example: Bearer {API_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

account_id   integer   

The ID of the account. Example: 1

survey_id   integer   

The ID of the survey. Example: 1

Query Parameters

per_page   integer  optional  

How many result per page. Defaults to 25, maximum is 50.

since   string  optional  

Start of timeframe to filter by (UTC timestamp of when the survey was answered). Defaults to 30 days ago. Example: 2023-05-01.

until   string  optional  

End of timeframe to filter by (UTC timestamp of when the survey was answered). Defaults to now. Example: 2023-05-09.

cursor   string  optional  

Cursor used to paginate through results.