Download OpenAPI specification:Download
This API allows a developer to access data from a companyes 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" }
{- "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 The id of the M2M subscription. |
{- "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 The id of the subscription. |
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.
{- "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 Seconds you want your calls to be answered within |
from_time required | string <date-time> Start of time interval as a ISO8601 timestamp |
to_time required | string <date-time> End of time interval as a 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.
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 | any The type of data to return. |
group_by required | any Aggregation key. |
start required | any Start of interval as an ISO 8601 date. |
end required | any End of interval as an ISO 8601 date. |
endpoint | any (Optional) Comma-separated string of endpoints to filter by. Endpoints of different types cannot be mixed. |
{- "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 | any Show voice mails recorded at or before this time. |
endpoint | any Show calls to specified employee or reception. |
limit | any Number of voicemails to show. |
number | any Show voice mails to or from specified 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 | any The ID of the voicemail. |
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"
}
{- "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"
}
}
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 the ID is greater than or equal to the 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
}
}
{- "comments": [
- {
- "id": 0,
- "contact_id": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}, - "employee_id": 0,
- "recipient_id": 0,
- "body": "string"
}
]
}
contact_id required | integer Contact ID |
object |
{- "comment": {
- "employee_id": 0,
- "body": "string",
- "recipient_id": 0
}
}
{- "comment": {
- "id": 0,
- "contact_id": {
- "id": 0,
- "name": "string",
- "number": "string",
- "number_formatted": "string",
- "email": "string",
- "tags": [
- "string"
], - "flagged": true,
- "comments_count": 0
}, - "employee_id": 0,
- "recipient_id": 0,
- "body": "string"
}
}
{- "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": "string",
- "smiley": "string",
- "started_at": "string",
- "status": "ringing",
- "to_contact": {
- "id": 0,
- "number": "string",
- "name": "string",
- "email": "string"
}, - "to_number": "string",
- "answered_at": "string",
- "answered_by": {
- "id": 0,
- "name": "string",
- "number": "string"
}, - "ended_at": "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": "string",
- "smiley": "string",
- "started_at": "string",
- "status": "ringing",
- "to_contact": {
- "id": 0,
- "number": "string",
- "name": "string",
- "email": "string"
}, - "to_number": "string",
- "answered_at": "string",
- "answered_by": {
- "id": 0,
- "name": "string",
- "number": "string"
}, - "ended_at": "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"
}
limit | any Number of Smileys returned. |
number | any Number on caller. Only return smileys given by this number. |
rated_at_lt_or_eq | any Return smileys where rated_at is less than or equal to this. |
rated_at_gt_or_eq | any Return smileys where rated_at is greater than or equal to this. |
endpoint | any Return smileys related to this Endpoint name. |
reception_id | any Deprecated Return smileys related to this Reception ID (deprecated). |
employee_id | any Return smileys related to this Employee ID. |
rating | any Return smileys with this rating. |
commented | any If given, only return smileys that have a comment. |
{- "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 | any The ISO 8601 representation of the wanted start of the time interval. |
to_time required | any The ISO 8601 representation of the wanted end of the time interval. |
endpoint | any (Optional) If given, only calculate statistics for the Endpoint with this name. |
reception_id | any Deprecated (Optional) Deprecated. If given, only calculate statistics for the Reception with this ID. |
employee_id | any (Optional) If given, only calculate statistics for the Employee with this ID. |
{- "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
}
]
}
]
}
}