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 a X-Api-Key header with the value "{YOUR_AUTH_KEY}".

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

Endpoints

Returns a page of campaigns.

requires authentication

Example request:
curl --request GET \
    --get "https://api.direct-result.be/v1/campaigns?count=25&page=1" \
    --header "X-Api-Key: {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.direct-result.be/v1/campaigns"
);

const params = {
    "count": "25",
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "X-Api-Key": "{YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

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

Example response (200):


{
    "data": [
        {
            "id": 92,
            "name": "Duis Dictum",
            "active": true,
            "phone_number": "+32809204909",
            "enable_emergency_signature": true,
            "enable_calling": true,
            "enable_sms_verification": true
        }
    ],
    "per_page": 100,
    "current": 1,
    "next": null,
    "previous": null,
    "total": 1
}
 

Request      

GET v1/campaigns

Headers

X-Api-Key      

Example: {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

count   integer   

The page size (between 1 and 100). Example: 25

page   integer   

The current page. Example: 1

Returns a page of subscriptions.

requires authentication

(Note: you will only be able to see the subscriptions that were enrolled within the past month)

Example request:
curl --request GET \
    --get "https://api.direct-result.be/v1/subscriptions?attributes=1&campaign=32&status=completed&before=1970-01-01&after=1970-01-01&count=25&page=1" \
    --header "X-Api-Key: {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.direct-result.be/v1/subscriptions"
);

const params = {
    "attributes": "1",
    "campaign": "32",
    "status": "completed",
    "before": "1970-01-01",
    "after": "1970-01-01",
    "count": "25",
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "X-Api-Key": "{YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

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

Example response (200):


{
    "data": [
        {
            "id": 473774,
            "status": "completed",
            "amount": 1200,
            "iban": "BE47549454364380",
            "datetime_of_registration": "2020-01-01T00:00:00+01:00",
            "datetime_of_cancelation": "2020-01-01T00:00:00+01:00",
            "start_date": "2020-01-01T00:00:00+01:00",
            "payment_interval": "0 years 1 mons 0 days 0 hours 0 mins 0.0 secs",
            "payment_interval_clean": "MONTHLY",
            "product_id": 42,
            "client_ref_code": "",
            "source": "sms",
            "creditation": false,
            "cancel_payment_recruiter": false,
            "purged": false,
            "first_payment_amount": 0,
            "purchase_id": "",
            "transaction_id": "",
            "used_first_pay": false,
            "is_structural": true,
            "is_onetimer": false,
            "is_cancellation": false,
            "subscriber": {
                "id": 495301,
                "first_name": "Shay",
                "middle_name": "",
                "last_name": "Marta",
                "gender": "female",
                "date_of_birth": "1980-01-01T00:00:00+01:00",
                "mobile": "+32585834200",
                "email": "shaymarta@localhost.com",
                "street": "Generaal Dossin de Saint Georgeslaan",
                "house_number": 13,
                "house_number_suffix": "",
                "city": "Brussels",
                "country": "BE",
                "initials": "",
                "landline": "",
                "zip_code": "1050",
                "bic": "BELLKM",
                "spoken_language": "FR"
            },
            "recruiter": {
                "code": "132406",
                "name": "Richard"
            },
            "welcome_call": {
                "status": "confirmed",
                "call_date": "2020-01-01"
            },
            "metadata": {
                "values": {
                    "foo": [
                        "Particulier"
                    ]
                },
                "attributes": {
                    "foo": {
                        "slug": "foo",
                        "choices": [
                            "Particulier",
                            "Societe"
                        ],
                        "type": "choice",
                        "metadata": {
                            "Societe": {
                                "label": "Sociéte"
                            },
                            "Particulier": {
                                "label": "Particulier"
                            }
                        },
                        "label": "Je suis",
                        "value_type": "text",
                        "required": true
                    }
                }
            },
            "campaign": {
                "id": 92,
                "name": "Duis Dictum",
                "active": true,
                "phone_number": "+32809204909",
                "enable_emergency_signature": true,
                "enable_calling": true,
                "enable_sms_verification": true
            }
        }
    ],
    "per_page": 1,
    "current": 1,
    "next": 2,
    "previous": null,
    "total": 576
}
 

Request      

GET v1/subscriptions

Headers

X-Api-Key      

Example: {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

attributes   boolean  optional  

Include the attribute metadata (subscription metadata values are always shown) Example: true

campaign   integer  optional  

The specific campaign ID to filter by. Example: 32

status   string  optional  

The specific status to filter by. Example: completed

before   date  optional  

Filters all entries before this date Example: 1970-01-01

after   date  optional  

Filters all entries after this date Example: 1970-01-01

count   integer   

The page size (between 1 and 100). Example: 25

page   integer   

The current page. Example: 1

Marks one or multiple subscriptions for completion.

requires authentication

(Note: you can only mark subscriptions that were enrolled within the past month)

Example request:
curl --request POST \
    "https://api.direct-result.be/v1/subscriptions/complete" \
    --header "X-Api-Key: {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"subscriptions\": [
        1,
        2,
        3
    ]
}"
const url = new URL(
    "https://api.direct-result.be/v1/subscriptions/complete"
);

const headers = {
    "X-Api-Key": "{YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "subscriptions": [
        1,
        2,
        3
    ]
};

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

Example response (204):

Empty response
 

Request      

POST v1/subscriptions/complete

Headers

X-Api-Key      

Example: {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

subscriptions   integer[]   

A list of subscription IDs.