Download OpenAPI specification:
This API allows a developer to access data from a Relatel account and to extend Relatel with new functionality.
All phone numbers include the country calling code, without 00 or + prefix. E.g. a Danish number would be: 4571999999.
Relatel supplies two types of products, a virtual switchboard and mobile subscriptions.
Different features and parts of the API depends on the user and/or company having the right features.
The switch product is our virtual switchboard. It has three different plans, Switch Starter, Switch Pro and Switch Premium.
Just a normal sim-card based mobile subscription, but with great love on top. All mobile subscriptions have the same API features.
The Relatel v2 REST API can be accessed via OAuth 2.0 or with a one-off Access Token which you can create here. This helps us track the usage of your application as well as providing the best possible security and safety to our users' data. OAuth 2.0 is a modern standard used by most providers, large and small.
To use the Relatel v2 REST API with oAuth 2.0 you need to first register your application. Given that each application is tied to it's own URL you might want to register one for development and one for production.
Please note that a user may at any time destroy their access tokens. You might want to take this into account when you're building your application.
Every request to a user's data is authenticated by an access token. To get one the user must accept that they want to use your app. They do this on our domain. Start by redirecting your user to the following address:
https://app.relatel.dk/api/v2/authorize?client_id=YOUR_APPLICATIONS_ID&response_type=code&redirect_uri=YOUR_APPLICATIONS_REDIRECT_URI
Users will be prompted to login (if they aren't already) and then asked if they want to grant you access to their account. If they agree, they are taken to your redirect_uri with a request token as a parameter.
http://example.com/callback?code=REQUEST_TOKEN
Your app then makes a POST request like this:
https://app.relatel.dk/api/v2/token?client_id=YOUR_APPLICATIONS_ID&client_secret=YOUR_APPLICATIONS_SECRET&grant_type=authorization_code&redirect_uri=YOUR_APPLICATIONS_REDIRECT_URI&code=REQUEST_TOKEN
The response will be JSON:
{ "access_token": "ACCESS_TOKEN" }
{- "chats": [
- {
- "uuid": "45981120-324b-0132-d3ef-14dae9edd21d",
- "answered_by": {
- "endpoint": "Employee#1",
- "name": "Jane Doe"
}, - "from_name": "John Doe",
- "from_email": "john@doe.dk",
- "endpoint": "ChatReception#1",
- "ended_at": "2019-08-24T14:15:22Z",
- "answered_at": "2019-08-24T14:15:22Z",
- "started_at": "2019-08-24T14:15:22Z",
- "state": "ringing"
}
]
}
{- "chat": {
- "uuid": "45981120-324b-0132-d3ef-14dae9edd21d",
- "answered_by": {
- "endpoint": "Employee#1",
- "name": "Jane Doe"
}, - "from_name": "John Doe",
- "from_email": "john@doe.dk",
- "endpoint": "ChatReception#1",
- "ended_at": "2019-08-24T14:15:22Z",
- "answered_at": "2019-08-24T14:15:22Z",
- "started_at": "2019-08-24T14:15:22Z",
- "state": "ringing"
}
}
{- "orders": [
- {
- "id": 1234,
- "type": "Order::ActivateM2M",
- "state": "completed",
- "pending_tasks": false
}, - {
- "id": 2345,
- "type": "Order::DeactivateM2M",
- "state": "completed",
- "pending_tasks": false
}
]
}
required | object |
{- "order": {
- "description": "Gylletank 34",
- "product_name": "m2m-small-one",
- "icc_id": "89450123456789012346"
}
}
{- "order": {
- "id": 1234,
- "type": "Order::ActivateM2m",
- "state": "completed",
- "icc_id": "89450123456789012346",
- "number": "4571991234",
- "subscription_id": 2345
}
}
required | object |
{- "order": {
- "number": "4571991234",
- "recycle_sim": true
}
}
{- "order": {
- "id": 1234,
- "type": "Order::DeactivateM2m",
- "state": "completed",
- "icc_id": "89450123456789012345",
- "number": "4571991234",
- "subscription_id": 2345
}
}
id required | integer M2M subscription ID |
{- "id": 4567,
- "description": "Gylletank 34",
- "order_id": 1234,
- "product_name": "m2m-small-one",
- "state": "active",
- "icc_id": "89450123456789012346",
- "ordered_on": "2024-01-10",
- "activated_on": "2024-01-10",
- "cancelled_on": null,
- "contract_expired_on": "2024-01-10",
- "overuse_limit_dkk": 1500
}
id required | integer Subscription ID |
required | object |
{- "subscription": {
- "description": "John's autocamper",
- "overuse_limit_dkk": 100
}
}
{- "id": 4567,
- "description": "John's autocamper",
- "order_id": 1234,
- "product_name": "m2m-small-one",
- "state": "active",
- "icc_id": "89450123456789012346",
- "ordered_on": "2024-01-10",
- "activated_on": "2024-01-10",
- "cancelled_on": null,
- "contract_expired_on": "2024-01-10",
- "overuse_limit_dkk": 100
}
object | |
numbers | Array of strings Phonenumbers to filter charges by. |
subscription_ids | Array of strings Ids of the subscriptions |
subscription_id,subscription_state,phone_number,product_name,icc,type,count,dkk_to_vat,dkk_no_vat,subscription_activated_on,subscription_cancelled_on,formatted_phone_number,description 1234,"active","4571991234","m2m-large","89450123456789012349","sms_roam","123","5.34","0.0","2024-01-05","2024-02-01","71 99 12 34","Tractor 12"
required | object |
{- "order": {
- "number": "4571991234",
- "recycle_sim": true
}
}
{- "order": {
- "id": 1234,
- "icc_id": "89450123456789012345",
- "number": "4571991234",
- "subscription_id": 2345
}
}
required | object |
{- "order": {
- "number": "4571991234",
- "mm": "m2m-large-one"
}
}
{- "order": {
- "id": 1234,
- "type": "Order::CompanyM2mToM2m",
- "state": "completed",
- "number": "4571991234",
- "subscription_id": 2345
}
}
Contacts are used to show information on the other party in a call and are shared with the entire company.
number | string Show contacts with the specified number |
limit | integer <= 100 Default: 10 Number of contacts to fetch |
id_gt_or_eq | integer Show contacts where ID is greater than or equal to specified value |
{- "contacts": [
- {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}
]
}
Create a new contact in the authenticated company
object (Contact) |
{- "contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}
}
{- "contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}
}
id required | integer Contact ID |
object (Contact) |
{- "contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}
}
{- "contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}
}
number required | string Contact phone number |
{- "contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}
}
contact_id required | integer Contact ID |
object |
{- "comment": {
- "employee_id": 0,
- "body": "string",
- "recipient_id": 0
}
}
{- "comment": {
- "id": 0,
- "contact_id": 0,
- "employee_id": 0,
- "recipient_id": 0,
- "body": "string"
}
}
{- "employees": [
- {
- "id": 0,
- "name": "string",
- "number": "string",
- "mobile_phone_number": "string",
- "switch_phone_number": "string",
- "admin": true,
- "admin_abilities": [
- {
- "name": "string",
- "enabled": true
}
], - "cloak_reception": "string",
- "company_id": 0,
- "dnd_timeout_at": "2019-08-24T14:15:22Z",
- "do_not_disturb": true,
- "subscription_ids": [
- 0
], - "employee_group_ids": [
- 0
], - "features": "mobile",
- "live_presence": "available",
- "speed_dial": {
- "digit": 0
}
}
]
}
{- "employee": {
- "id": 0,
- "name": "string",
- "number": "string",
- "mobile_phone_number": "string",
- "switch_phone_number": "string",
- "admin": true,
- "admin_abilities": [
- {
- "name": "string",
- "enabled": true
}
], - "cloak_reception": "string",
- "company_id": 0,
- "dnd_timeout_at": "2019-08-24T14:15:22Z",
- "do_not_disturb": true,
- "subscription_ids": [
- 0
], - "employee_group_ids": [
- 0
], - "features": "mobile",
- "live_presence": "available",
- "speed_dial": {
- "digit": 0
}
}
}
id required | integer Employee ID |
employee | object |
{- "employee": { }
}
{- "employee": {
- "id": 0,
- "name": "string",
- "number": "string",
- "mobile_phone_number": "string",
- "switch_phone_number": "string",
- "admin": true,
- "admin_abilities": [
- {
- "name": "string",
- "enabled": true
}
], - "cloak_reception": "string",
- "company_id": 0,
- "dnd_timeout_at": "2019-08-24T14:15:22Z",
- "do_not_disturb": true,
- "subscription_ids": [
- 0
], - "employee_group_ids": [
- 0
], - "features": "mobile",
- "live_presence": "available",
- "speed_dial": {
- "digit": 0
}
}
}
{- "employee": {
- "id": 0,
- "name": "string",
- "number": "string",
- "mobile_phone_number": "string",
- "switch_phone_number": "string",
- "admin": true,
- "admin_abilities": [
- {
- "name": "string",
- "enabled": true
}
], - "cloak_reception": "string",
- "company_id": 0,
- "dnd_timeout_at": "2019-08-24T14:15:22Z",
- "do_not_disturb": true,
- "subscription_ids": [
- 0
], - "employee_group_ids": [
- 0
], - "features": "mobile",
- "live_presence": "available",
- "speed_dial": {
- "digit": 0
}
}
}
employee | object |
{- "employee": { }
}
{- "employee": {
- "id": 0,
- "name": "string",
- "number": "string",
- "mobile_phone_number": "string",
- "switch_phone_number": "string",
- "admin": true,
- "admin_abilities": [
- {
- "name": "string",
- "enabled": true
}
], - "cloak_reception": "string",
- "company_id": 0,
- "dnd_timeout_at": "2019-08-24T14:15:22Z",
- "do_not_disturb": true,
- "subscription_ids": [
- 0
], - "employee_group_ids": [
- 0
], - "features": "mobile",
- "live_presence": "available",
- "speed_dial": {
- "digit": 0
}
}
}
Send an SMS message to the given employee. The sender will be shown as either the authenticated employee's number or name.
id required | integer Employee ID |
object |
{- "message": {
- "body": "string"
}
}
{- "sent": 0
}
Employee groups are collections of employees that can be used to dial or transfer to multiple employees at once.
object |
{- "employee_group": {
- "name": "string",
- "employee_ids": [
- 0
]
}
}
{- "id": 0,
- "name": "string",
- "live_presence": "available",
- "speed_dial": {
- "digit": "string"
}, - "employee_ids": [
- 0
]
}
id required | integer Employee group ID |
employee_group | object |
{- "employee_group": { }
}
{- "id": 0,
- "name": "string",
- "live_presence": "available",
- "speed_dial": {
- "digit": "string"
}, - "employee_ids": [
- 0
]
}
Send an SMS message to all employees in this group. The sender will be shown as either the authenticated employee's number or name. Beware: these are cheap, but not free. Take a look at the pricelist for Web SMS. This feature is not available for companies in trial.
employee_group_id required | integer Employee group ID |
body | string The content of the SMS |
{- "body": "string"
}
{- "sent": 0
}
Get call statistics for a given period. You can provide answer targets, and the server will calculate how many calls is within the given targets.
id required | integer Reception ID |
answer_target required | integer Target call answer time in seconds |
from_time required | string <date-time> Start of time interval as ISO8601 timestamp |
to_time required | string <date-time> End of time interval as ISO8601 timestamp |
phase | string Enum: "open" "closed" "backup" Comma-separated list of phases to include in statistics |
{- "statistics": {
- "total": 0,
- "answered": 0,
- "missed": 0,
- "average_answer_time": 0,
- "average_duration": 0,
- "within_target": {
- "missed": 0,
- "answered": 0
}
}
}
Smileys are the feedback from people who have contacted a reception.
After the call or chat has ended, the caller will receive an SMS or email asking for feedback on how the conversation went. This feedback is called a smiley.
limit | integer <= 100 Default: 10 Number of smileys to return |
number | string Filter smileys by caller number |
rated_at_lt_or_eq | string <date-time> Return smileys where rated_at is less than or equal to this value |
rated_at_gt_or_eq | string <date-time> Return smileys where rated_at is greater than or equal to this value |
endpoint | string Filter smileys by endpoint name |
reception_id | integer Deprecated Filter smileys by reception ID (deprecated) |
employee_id | integer Filter smileys by employee ID |
rating | integer Enum: 0 1 Filter smileys by rating |
commented | boolean Filter smileys that have comments |
{- "smileys": [
- {
- "id": 0,
- "call_uuid": "string",
- "conversation_type": "call",
- "conversation_uuid": "string",
- "rated_at": "2019-08-24T14:15:22Z",
- "sort_value": "2019-08-24T14:15:22Z",
- "rating": 0,
- "net_promoter_score": 0,
- "kind": "negative",
- "emoji": "string",
- "comment": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "contact": { },
- "endpoint": "string",
- "reception_id": 0,
- "employee_id": 0,
- "call_recording": { }
}
]
}
from_time required | string <date-time> Start of time interval as ISO8601 timestamp |
to_time required | string <date-time> End of time interval as ISO8601 timestamp |
endpoint | string Filter statistics by endpoint name (optional) |
reception_id | integer Deprecated Filter statistics by reception ID (optional, deprecated) |
employee_id | integer Filter statistics by employee ID (optional) |
{- "statistics": {
- "receptions": [
- {
- "id": 0,
- "endpoint": "string",
- "smileys_count": 0,
- "positive_smileys_count": 0,
- "negative_smileys_count": 0,
- "commented_smileys_count": 0,
- "smiley_requests_count": 0,
- "average_rating": 0.1,
- "employees": [
- {
- "id": 0,
- "average_rating": 0.1,
- "smileys_count": 0,
- "positive_smileys_count": 0,
- "negative_smileys_count": 0,
- "commented_smileys_count": 0
}
]
}
]
}
}
The Statistics API allows you to get aggregated stats about calls and chats. The data is updated every 1-2 hours, not in real-time like the other APIs.
endpoint_type required | string Enum: "Reception" "ChatReception" "Employee" Type of statistics to return |
group_by required | string Enum: "employee_id" "reception_id" "chat_reception_id" "ivr_key" "period_month" "period_week" "period_day" "period_hour" How to group the statistics |
start required | string <date-time> Start of interval as ISO8601 timestamp |
end required | string <date-time> End of interval as ISO8601 timestamp |
endpoint | string Filter by specific endpoints (comma-separated, optional) |
{- "rows": [
- {
- "key": "string",
- "period_month": "2019-08-24T14:15:22Z",
- "period_week": "2019-08-24T14:15:22Z",
- "period_hour": "2019-08-24T14:15:22Z",
- "ivr_key": "string",
- "endpoint": "string",
- "call_count": 0,
- "call_answered_count": 0,
- "call_missed_count": 0,
- "call_closed_count": 0,
- "call_incoming_count": 0,
- "call_outgoing_count": 0,
- "call_answer_time_average": 0,
- "call_duration_average": 0,
- "call_duration_total": 0,
- "call_sla": 0,
- "smiley_count": 0,
- "rating_average": 0
}
]
}
created_at_lt_or_eq | string <date-time> Filter voicemails recorded at or before this timestamp |
endpoint | string Filter voicemails by endpoint |
limit | integer <= 100 Default: 10 Number of voicemails to return |
number | string Filter voicemails by phone number |
{- "voice_mails": [
- {
- "id": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "heard": true,
- "duration": 0,
- "endpoint": "string",
- "from_number": "string",
- "from_contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}, - "message": "string",
- "comment": "string"
}
]
}
{- "id": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "heard": true,
- "duration": 0,
- "endpoint": "string",
- "from_number": "string",
- "from_contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}, - "message": "string",
- "comment": "string"
}
id required | integer Voicemail ID |
object |
{- "voice_mail": {
- "heard": true,
- "comment": "string"
}
}
{- "id": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "heard": true,
- "duration": 0,
- "endpoint": "string",
- "from_number": "string",
- "from_contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}, - "message": "string",
- "comment": "string"
}
started_at_lt_or_eq | string <date-time> Return calls where started_at is less than or equal to this value |
started_at_gt_or_eq | string <date-time> Return calls where started_at is greater than or equal to this value |
ended_at_lt_or_eq | string <date-time> Return calls where ended_at is less than or equal to this value |
ended_at_gt_or_eq | string <date-time> Return calls where ended_at is greater than or equal to this value |
limit | number Maximum number of calls to return |
direction | string Enum: "incoming" "outgoing" Filter calls by direction |
endpoint | string Filter calls by endpoint name |
{- "calls": [
- {
- "call_uuid": "string",
- "company_id": 0,
- "direction": "incoming",
- "endpoint": "string",
- "endpoint_type": "employee",
- "from_number": "string",
- "from_contact": {
- "id": 0,
- "number": "string",
- "name": "string",
- "email": "string"
}, - "ringing_at": "2019-08-24T14:15:22Z",
- "smiley": "string",
- "started_at": "2019-08-24T14:15:22Z",
- "status": "ringing",
- "to_contact": {
- "id": 0,
- "number": "string",
- "name": "string",
- "email": "string"
}, - "to_number": "string",
- "answered_at": "2019-08-24T14:15:22Z",
- "answered_by": {
- "id": 0,
- "name": "string",
- "number": "string"
}, - "ended_at": "2019-08-24T14:15:22Z",
- "recording": {
- "id": 0,
- "sound": {
- "formats": [
- "string"
], - "url": "string"
}
}, - "input_data": [
- {
- "name": "string",
- "value": "string"
}
]
}
]
}
{- "call": {
- "call_uuid": "string",
- "company_id": 0,
- "direction": "incoming",
- "endpoint": "string",
- "endpoint_type": "employee",
- "from_number": "string",
- "from_contact": {
- "id": 0,
- "number": "string",
- "name": "string",
- "email": "string"
}, - "ringing_at": "2019-08-24T14:15:22Z",
- "smiley": "string",
- "started_at": "2019-08-24T14:15:22Z",
- "status": "ringing",
- "to_contact": {
- "id": 0,
- "number": "string",
- "name": "string",
- "email": "string"
}, - "to_number": "string",
- "answered_at": "2019-08-24T14:15:22Z",
- "answered_by": {
- "id": 0,
- "name": "string",
- "number": "string"
}, - "ended_at": "2019-08-24T14:15:22Z",
- "recording": {
- "id": 0,
- "sound": {
- "formats": [
- "string"
], - "url": "string"
}
}, - "input_data": [
- {
- "name": "string",
- "value": "string"
}
]
}
}
CAUTION: When using this API, please be aware that an actual call will be made every time the endpoint is called. Once the authenticated employee's phone is answered, a call will be made to the specified recipient.
to_number | string The number you want to dial. Should be prepended with country code. |
restrict_to | string Enum: "" "web_call" "mobile" Can be empty, "web_call", or "mobile". If present, only rings on that device. |
cloak_reception_id | string (Optional) If present, the phone number associated with this reception is used as the from-number. See the Reception documentation. |
{- "to_number": 4571999999,
- "restrict_to": "",
- "cloak_reception_id": "string"
}
{- "message": "Call initiated successfully"
}
created_at_lt_or_eq | string <date-time> Filter messages created before this timestamp |
created_at_gt_or_eq | string <date-time> Filter messages created after this timestamp |
endpoint | string Filter messages by endpoint |
{- "messages": [
- {
- "id": 0,
- "from_contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}, - "to_contact": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}, - "from_name": "string",
- "from_number": "string",
- "from_number_formatted": "string",
- "from_number_hidden": true,
- "to_number": "string",
- "to_name": "string",
- "to_number_formatted": "string",
- "endpoint": "string",
- "employee": {
- "id": 0,
- "name": "string",
- "number": "string",
- "mobile_phone_number": "string",
- "switch_phone_number": "string",
- "admin": true,
- "admin_abilities": [
- {
- "name": "string",
- "enabled": true
}
], - "cloak_reception": "string",
- "company_id": 0,
- "dnd_timeout_at": "2019-08-24T14:15:22Z",
- "do_not_disturb": true,
- "subscription_ids": [
- 0
], - "employee_group_ids": [
- 0
], - "features": "mobile",
- "live_presence": "available",
- "speed_dial": {
- "digit": 0
}
}, - "direction": "incoming",
- "body": "string",
- "sort_value": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z"
}
]
}