Lexly API
General Information
Version 1.7.2
Schemes
https
Host & base path
{customer_site}/api/v1/
Terms of Service
In using this API you agree to be bound by our Terms of Service
OpenAPI specification
OpenAPI specification for partly of this APIs can be accessible here: http://apidocs.lexly.com/v1/swagger.yaml
Overview
The Lexly API uses HTTPS methods and RESTful endpoints to create, edit, and manage meetings with lawyers at a customer site. JSON is the data interchange format, but we also use query parameters.
The API is accessed through a versioned URL. This allows users to clearly identify which API they are using, and to make it easier to upgrade to any newer versions. It also avoids having to use version codes in HTTP headers.
Any breaking changes to the API will be introduced through a new version number. We aim to keep these changes to a minimum, and when we do so, will support the current API until it is phased out.
Changelog
We will list any changes to the current version of the API here.
Date | Details of changes |
---|---|
API Version 1.7.2 was released. Adding Accept-Language support for POST/GET partnerform. | |
API Version 1.7.1 was released. Some updates and corrections of the partnerform documentation. | |
API Version 1.7.0 was released. An update of GET contact is launched and support for JWT. | |
API Version 1.6.2 was released. An update of GET partnerform is launched | |
API Version 1.6.1 was released. A new function for sending partner lead has been added. GET/POST partnerform | |
API Version 1.5.16 was released. A minor update to instantly send out an authorization link when a customer tries to register a new account for an email address that already exists. | |
API Version 1.5.15 launched. Possibility to send partner_id to meeting/free added. | |
API Version 1.5.14 launched. New functions are added in BankID upgrade. | |
API Version 1.5.13 launched. New GET and POST functions added for dynamic contact forms. | |
API Version 1.5.12 launched. Possibility for booking video meeting added. Updated implementation example - implementation of online meeting booking added. Stirling Blue as a brand was replaced with Lexly. | |
API Version 1.5.11 launched. Small bug fixes with partnerform and meeting. | |
API Version 1.5.10 launched. Adding a function to post partner leads (partnerform). | |
API Version 1.5.9 launched. An implementation example has been added. | |
API Version 1.5.8 launched. Smaller updates of agreements API. | |
API Version 1.5.7 launched. Adding a function to get subscriptions for business services. | |
API Version 1.5.6 launched. Adding function upgradeToBankIdVerificationMail and authenticateBankIdUpgrade. | |
API Version 1.5.5 launched. Adding company and getCompanyInfo. | |
API Version 1.5.4 launched. Adding getSessionId, possibility to register a new BankID user and update SSN at customer update. | |
API Version 1.5.3 launched. Possibility to reset a users password and same new fileinfo added for users. | |
API Version 1.5.2 launched. Possibility to subscribe to newsletters. | |
API Version 1.5.1 launched. Possibility to delete documents owned by the customer who has logged in. | |
API Version 1.5.0 launched. Support for posting and getting agreement flows has been added. | |
API Version 1.4.4 launched. Possibility to login with BankID added. | |
API Version 1.4.3 launched. Small updates of the pricelist. | |
API Version 1.4.2 launched. Possibility to get a priclist for current products. | |
API Version 1.4.1 launched. Possibility to update user info (PUT for user). | |
API Version 1.4 launched. Some changes regarding oauth is done as possibilities to create a new user directly on the login process. | |
API Version 1.3 launched. Some new functionalities added and Partner Oauth Credentials authorisation. Possibility to register a new customer via API. | |
2019-04-30 | API Version 1.2 launched. Some new functionalities added and OAuth authorisation (Partner Oauth Credentials, CID). |
2019-02-20 | API Version 1 launched |
Quick Start
To get started using our API it is recommended to first read the Introduction, this will give you an overview of some key concepts in use by the Lexly system.
Introduction
Lexlys API is a system for identifying clients, booking meetings with lawyers and receiving customer information and conveying purchased contracts.
Authentication
Partner Access Credentials
Auth Workflow using cURL
Here we provide some examples using the cURL command.
1. Authorization for via cURL:
$ curl 'https://${host}/api/v1/${api}' \
-H 'Auth: user=${username},password=${password},partner=${partner_id}
Instead of OAuth, partners can access certain APIs with authentication based on relayed login information.
You as a partner can get the authorization information. Once you have it, you can access the APIs by sending the authorization information in the header regardless of whether you are using POST or GET. It should be written in the following format:
Auth: user=${username},password=${password},partner=${partner_id}
The following APIs can be accessed in this way:
Errors
Error responses will contain a JSON response body, structured as follows:
{
"error_type": "${error_type}",
"error_message": "${error_type}",
"http_code": ${http_code}
}
For example:
{
"error_type": "invalid_client",
"error_message": "The client id supplied is invalid",
"http_code": 400
}
Lexly uses HTTP status codes to indicate the success or failure of an API request.
HTTP response codes in the 2xx
range indicate that the API call completed
successfully.
The 4xx
range indicates an error, either due to missing, incomplete, or
not applicable information (e.g. missing or invalid parameters, invalid
authorisation, etc.).
When a request is well formed, but does not satisfy necessary conditions,
then we will return a 409
code.
For example, when trying to book a meeting that's already booked.
Codes in the 5xx
range suggest an error with Lexlys booking system, they
could also indicate planned system downtime, and will be rare.
The following table of error responses applies to all API calls, there may be additional errors which are specific to the respective API calls, but will follow the same structure.
HTTP code | Reason | Error Type and Message |
---|---|---|
400 Bad Request | Required parameter(s) missing |
The parameter(s) |
400 Bad Request | Login failure (Oauth specific) - different error messages |
The grant_type is invalid
"Client credentials were not found in the headers or body", "Supplied response_type isn't supported", "No client id supplied", "The client id supplied is invalid" |
400 Bad Request | Login failure (Calendar specific) - different error messages |
Missing needed calendar information.
Missing needed deal id.
Missing needed advisor information. |
400 Bad Request | Failed to upload a file (upload specific) |
This file type is not supported.
Failed to upload file. |
401 Unauthorised | No or invalid access credentials |
No valid access credentials were provided. Please refer to our API documentation.
Authorization code doesn't exist or is invalid for the client |
401 Unauthorised | No or invalid access credentials (oauth specific) |
No valid access credentials were provided. Please refer to our API documentation.
Authorization code doesn't exist or is invalid for the client
The user exist but the password is invalid.
The user exist, please login with bankid.
The user exist, please login with password.
Some error with the auth credentials or the credentials may not have sufficient privileges. |
401 Unauthorised | No or invalid access credentials (account specific) |
You don't have access for the requested id. |
403 Forbidden | User doesn’t have permission for a document action or retrieval |
The access credentials provided do not have sufficient privileges for this request. |
403 Forbidden | User doesn’t have permission for a document action or retrieval (oauth specific) |
Auth credentials are invalid or they may not have sufficient privileges. |
404 Not Found | The endpoint exists but the resource was not found. |
The resource was not found. We will try to give additional information about what is missing. |
409 Conflict | New new user is registered but the . |
The user already exist. |
500 Server Error | Other unexpected server error |
We encountered an unexpected error. Please contact Lexly support and include as much details about what caused the error. |
List of API Calls
Get
Post
Get
Get image v1
Example of a returned image:
Code: <img src="https://api.lexly.se/api/v1/image/housing-situation/tomorrow?situation=bought-before&gender=man&gender-partner=woman">
Code: <img src="https://api.lexly.se/api/v1/image/inheritance-analysis/i-die?situation=married&gender=man&gender-partner=woman&children=1,6&orphan-children=5">
Code: <img src="https://api.lexly.se/api/v1/image/life-insurance/with/partner-die?gender=man&gender-partner=woman&children=1,6&orphan-children=5">
GET https://api.lexly.se/api/v1/image/housing-situation/{today|tomorrow}?<situation={married|partner|bought-before}>&<gender={man|woman}>&<gender-partner={man|woman}>
GET https://api.lexly.se/api/v1/image/inheritance-analysis/{today|i-die|partner-die}?<situation={single|married|partner}>&<gender={man|woman}>&<gender-partner={man|woman}>&<children={age,age,...}>&<orphan-children={age,age,...}>&<bonus-children={age,age,...}>
GET https://api.lexly.se/api/v1/image/life-insurance/{with|without}/{i-die|partner-die}?<gender={man|woman}>&<gender-partner={man|woman}>&<children={age,age,...}>&<orphan-children={age,age,...}>&<bonus-children={age,age,...}>
With this API, SVG images can be generated based on specified parameters in different situations in life. The tool has support for creating images for life situations housing situation, inheritance analysis and life insurance.
Header
Header | Description | Example |
---|---|---|
Nothing required. |
Parameters
When generating an image for housing situation. Potential URL /api/v1/image/housing-situation/today and /api/v1/image/housing-situation/tomorrow. All parameters below
should be send in the QUERY_STRING.
Please note: If it's a partner relation and the house was bought before the partners moved together, set the situation to "bought-before".
Dimention: 4:3
Parameter | Description | Type | In |
---|---|---|---|
| The current life situation. If it is a single person, this parameter is not needed. | string | path |
| The gender of the primary person in the picture. | string | path |
| The gender of the primary persons partner in the picture. If it is a single person, this parameter is not needed. | string | path |
When generating an image for life insurance. Potential URL /api/v1/image/inheritance-analysis/today, /api/v1/image/inheritance-analysis/i-die and /api/v1/image/inheritance-analysis/partner-die. All parameters below should be send in the QUERY_STRING.
Dimention: 1:1
Parameter | Description | Type | In |
---|---|---|---|
| The current life situation. If it is a single person, this parameter is not needed. | string | path |
| The gender of the primary person in the picture. | string | path |
| The gender of the primary persons partner in the picture. If it is a single person, this parameter is not needed. | string | path |
| A list of the ages of the common children. | numbers, separated with , | path |
| A list of the ages of the orphaned children. | numbers, separated with , | path |
| A list of the ages of the bonus children. | numbers, separated with , | path |
When generating an image for inheritance analysis. Potential URL /api/v1/image/life-insurance/without/i-die, /api/v1/image/inheritance-analysis/without/partner-die, /api/v1/image/life-insurance/with/i-die and /api/v1/image/inheritance-analysis/with/partner-die. All parameters below should be send in the QUERY_STRING.
Dimention: 3:2
Parameter | Description | Type | In |
---|---|---|---|
| The gender of the primary person in the picture. | string | path |
| The gender of the primary persons partner in the picture. If it is a single person, this parameter is not needed. | string | path |
| A list of the ages of the common children. | numbers, separated with , | path |
| A list of the ages of the orphaned children. | numbers, separated with , | path |
| A list of the ages of the bonus children. | numbers, separated with , | path |
Responses
An image is always returned from this API. If the parameters are not set correctly, the answer will be just an empty house image.
Get image v2
Example of a returned image:
Code: <img src="https://api.lexly.se/api/v2/image/housing-situation/tomorrow?situation=bought-before&gender=man&gender-partner=woman">
Code: <img src="https://api.lexly.se/api/v2/image/housing-situation/alone?gender=woman">
GET https://api.lexly.se/api/v2/image/housing-situation/{alone|today|tomorrow}?<situation={married|partner|bought-before}>&<gender={man|woman|neutral}>&<gender-partner={man|woman|neutral}>
GET https://api.lexly.se/api/v2/image/inheritance-analysis/{today|i-die|partner-die}?<situation={single|married|partner}>&<gender={man|woman|neutral}>&<gender-partner={man|woman|neutral}>&<children={age,age,...}>&<orphan-children={age,age,...}>&<bonus-children={age,age,...}>
GET https://api.lexly.se/api/v2/image/life-insurance/{with|without}/{i-die|partner-die}?<gender={man|woman|neutral}>&<gender-partner={man|woman|neutral}>&<children={age,age,...}>&<orphan-children={age,age,...}>&<bonus-children={age,age,...}>
GET https://api.lexly.se/api/v2/image/coins/{two|four|down}
GET https://api.lexly.se/api/v2/image/carries-house/{woman|man|neutral}
With this API, SVG images can be generated based on specified parameters in different situations in life. The tool has support for creating images for life situations housing situation, inheritance analysis and life insurance.
Header
Header | Description | Example |
---|---|---|
Nothing required. |
Parameters
When generating an image for housing situation. Potential URL /api/v2/image/housing-situation/today and /api/v2/image/housing-situation/tomorrow. All parameters below
should be send in the QUERY_STRING.
Please note: If it's a partner relation and the house was bought before the partners moved together, set the situation to "bought-before".
For generating an image with just one person and a house use /api/v2/image/housing-situation/alone?gender={man|woman|neutral}
Dimention: 82:37
Parameter | Description | Type | In |
---|---|---|---|
| The current life situation. If it is a single person, this parameter is not needed. | string | path |
| The gender of the primary person in the picture. | string | path |
| The gender of the primary persons partner in the picture. If it is a single person, this parameter is not needed. | string | path |
Code: <img src="https://api.lexly.se/api/v2/image/inheritance-analysis/i-die?situation=married&gender=man&gender-partner=woman&children=1,6&orphan-children=5">
When generating an image for inheritance analysis. Potential URL /api/v2/image/inheritance-analysis/today, /api/v2/image/inheritance-analysis/i-die and /api/v2/image/inheritance-analysis/partner-die. All parameters below should be send in the QUERY_STRING.
Dimention: 55:43
Parameter | Description | Type | In |
---|---|---|---|
| The current life situation. If it is a single person, this parameter is not needed. | string | path |
| The gender of the primary person in the picture. | string | path |
| The gender of the primary persons partner in the picture. If it is a single person, this parameter is not needed. | string | path |
| A list of the ages of the common children. | numbers, separated with , | path |
| A list of the ages of the orphaned children. | numbers, separated with , | path |
| A list of the ages of the bonus children. | numbers, separated with , | path |
Code: <img src="https://api.lexly.se/api/v2/image/life-insurance/with/partner-die?gender=man&gender-partner=woman&children=1,6&orphan-children=5">
When generating an image for life insurance. Potential URL /api/v2/image/life-insurance/without/i-die, /api/v2/image/inheritance-analysis/without/partner-die, /api/v2/image/life-insurance/with/i-die and /api/v2/image/inheritance-analysis/with/partner-die. All parameters below should be send in the QUERY_STRING.
Dimention: 3:2
Parameter | Description | Type | In |
---|---|---|---|
| The gender of the primary person in the picture. | string | path |
| The gender of the primary persons partner in the picture. If it is a single person, this parameter is not needed. | string | path |
| A list of the ages of the common children. | numbers, separated with , | path |
| A list of the ages of the orphaned children. | numbers, separated with , | path |
| A list of the ages of the bonus children. | numbers, separated with , | path |
Code: <img src="https://api.lexly.se/api/v2/image/coins/two">
<img src="https://api.lexly.se/api/v2/image/coins/four">
<img src="https://api.lexly.se/api/v2/image/coins/down">
For generating images of coins there are three different potential images: /api/v2/image/coins/two, /api/v2/image/coins/four and /api/v2/image//coins/down.
Dimention: 198:129 - /api/v2/image/coins/two
|
Example of usage. |
Code: <img src="https://api.lexly.se/api/v2/image/carries-house?gender=woman">
For generating images of a human wearing a house the input should be in the following format: /api/v2/image/carries-house?gender={woman|man|neutral}
Dimention: 2:3
Parameter | Description | Type | In |
---|---|---|---|
| The gender of the primary person in the picture. | string | path |
Responses
An image is always returned from this API. If the parameters are not set correctly, the answer will be just an empty house image.
Get free meeting slots
Example of returned data (day):
{
"date": "2019-03-20",
"open_time": "8-20",
"slot_length": 30,
"partner": "testab",
"deal_id": "100",
"slots": [
{
"starttime": "0800",
"length": "30",
"lawyer": "116767"
},
{
"starttime": "0830",
"length": "30",
"lawyer": "97940"
}
]
}
Example of returned data (month):
{
"category": "business",
"freeslots": [
"2021-12-01",
"2021-12-06",
"2021-12-17",
"2021-12-30"
]
}
GET /api/v1/meeting/{date or month}/{dealid}?<partner={partner_shortname}>&
GET /api/v1/meeting/{date or month}/{dealid}?<partner={partner_shortname}>&
GET /api/v1/meeting/{date or month}?<product={product_id}>&<category={private|business}>&<type={1 or 2}> (Oauth or CID)
GET /api/v1/meeting/{date or month}?<product={product_id}>&&<category={private|business}>&<type={1 or 2}> (Oauth or CID)
This API can be used for receiving two different kind of data. If just a month (YYYY-MM) is sent sent in the URL all dates in the month with free slots will be returned. If a specific date is sent all free meeting slots for a given date will be returned. This function can be requested either by CID, Partner Access Credentials or Oauth. Required parameters depends on if it's accessed with CID, Partner Access Credentials or Oauth. The output is in JSON format.
In the swedish version you can send product category instead of product_id. The available categories are "business" and "private".
Header
Header | Description | Example |
---|---|---|
| Supports all kind of authentication | See Authentication |
| Used for setting the the time zone for incoming and outgoing date and time stamps. As default it's set to GMT (except for avtal24.se that's set to Europe/Stockholm). | TimeZone: Europe/Paris |
Parameters
Parameter | Description | Type | In |
---|---|---|---|
| Use date to receive free slots for the given date OR use month to get all dates in the given month with free slots. | date | path |
| The partner short name (customer segment) (ex "mybank") the customer is connected to. This shouldn't be included on CID or OAuth authorisation. | string | query_string |
| The partner_id (customer segment) the customer is connected to. This shouldn't be included on CID or OAuth authorisation. | integer | query_string |
| The deal_id (customer segment) the customer is connected to. This is required on Partner Access Credentials but shouldn't be included on CID or OAuth authorisation. | integer | path (after date see above) or query_string |
| Can be given to get correct length (type) and free slots for a lawyer who's working with the given product. Example of product (id) is 10232. | integer | query_string |
| Can be used for get free slots for a lawyer who's working with private or business agreements (just used in Sweden). The default value if nothing is given is 'private'. Possible values: 'private', 'business' | string | query_string |
| You can get free slots for 30 or 60 min. The default value '2' gives free 30 min slots and '1' gives free 60 min slots. | integer | query_string |
Responses
Code | Description |
---|---|
200 | The free meeting slots available to book for the customer. The data is returned in JSON format. |
400 | Required fields missing or incorrect. |
Get partner form structure
Example of returned data:
{
"customer_segments": [
{
"name": "Privatkund",
"deal_id": 32,
},
...
],
"legal_areas": [
{
"name": "Familjejuridik",
"value": "family-law",
"form_type": "flexible_form",
"category": "private",
},
...
],
"form_types": [
"flexible_form": {
"contact_form": {
"meeting_type": "Mail",
"form_type": [
"contact_form"
]
},
...
},
"contact_form": {
"preferred_meeting_type": [
{
"name": "Telefon",
"value": "phone",
},
...
],
"return_fields": {
"deal_id": required,
"legal_area": "required",
"preferred_meeting_type": "required",
"customer": {
"ssn": "required",
"name": "required",
"email": "required",
"phone": "required"
},
"advisor": {
"email": "required",
"group": "required",
"subgroup": "optional"
}
}
},
...
],
}
GET /api/v1/partnerform/
Get the structure for a partner form for the partner that's specified in the authorization header. It will return info about the customer_segments, the current legal_areas and the fields that should be returned for the different legal areas for the current partner. The form type "flexible_form" lists which different form setups that should be returned for the different potential selections.
Header
Header | Description | Example |
---|---|---|
| Only supports Partner Access Credentials | See Authentication |
| Specify the language in which the content should be returned. Possible languages are indicated as the following - only one should be specified: sv, en, etc |
Parameters
Parameter | Description | Type | In |
---|---|---|---|
Doesn't take any parameters. |
Responses
Code | Description |
---|---|
200 | The data is returned in JSON format and describes potential forms and which values that should be posted to contactform. |
Get pricelist
Example of returned data:
{
"business_agreements": [
{
"id": "9761",
"product_name": "Aktieägaravtal",
"product_description": "Kompanjonsavtal mellan ägarna i ett aktiebolag",
"vat": 25,
"slug": "aktieagaravtal",
"translation_price": 2800,
"online": {
"product_number": 2071,
"price": 2995,
"temp_price": 2750
},
"lawyer": {
"product_number": 2571,
"price": 9999,
"temp_price": 9500
}
},
...
]
}
GET /api/v1/pricelist
GET /api/v1/pricelist/{deal_id}
Get the pricelist for the current deal_id. If deal_id isn't included in the request the general pricelist will be returned. The data is returned in JSON format.
Header
Header | Description | Example |
---|---|---|
| Is required when a deal_id is included in the URL. Supports Partner OAuth Credentials, CID and OAuth | See Authentication |
Parameters
Parameter | Description | Type | In |
---|---|---|---|
Doesn't take any parameters. |
Responses
Code | Description |
---|---|
200 | Information about the current user and bought agreements. The data is returned in JSON format. |
Response data
The data will be returned organized in four different categories - "business_agreements", "offers", "private_agreements", "addons".
Variable | Description | Type | In |
---|---|---|---|
id | The ID of the product | Integer | |
product_name | The name of the product | String | |
brief_description | A short description of the product | String | |
product_description | A description of the product | String | |
vat | The current VAT for the product i percent | Float | |
category | Can have one or more value(s) of 'private' and 'business' | String | |
slug | The part of a URL which identifies the particular product | String | a-z |
translation_price | The price for translating the product | Float | |
online > product_number | The products "product number" | Integer | |
online > price | Standard price for the product online | Float | |
online > temp_price | A temporary price for the product online | Float | |
online > partner_price | The products price via the current partner | Float | |
online > partner_discount | The partner discount for the current partner in percent | Float | |
lawyer > product_number | The products "product number" | Integer | |
lawyer > price | Standard price for the product via a lawyer | Float | |
lawyer > temp_price | A temporary price for the product via a lawyer | Float | |
lawyer > partner_price | The products price via the current partner | Float | |
lawyer > partner_discount | The partner discount for the current partner in percent | Float |
Post
Send partner form info
Example of posted data (with Partner Access Credentials authorisation):
{
"deal_id": 100,
"legal_area": family-law,
"customer": {
"name": "Lars Nilsson",
"email": "lars@nilsson.eu",
"phone": "0732220825",
"ssn": "196503080291" }
"calendar": {
"type": "phone",
"date": "2022-07-15",
"time": "1400",
"lawyer": "85494" }
"advisor": {
"name": "Nils Bankir",
"email": "a12342@banken.se",
"phone": "0771121212",
"group": "Stockholm",
"subgroup": "Norrmalmstorg" }
}
Example of returned data if all went well:
{
"status": "true"
}
POST /api/v1/partnerform
An API for sending a partner leads. This can only be done with a Partner Access Credentials. The different setup of returned values depends of selected form type - see Get partner form structure.
Header
Header | Description | Example |
---|---|---|
| Only supports Partner Access Credentials | See Authentication |
| Specify the language in which the content should be sent. Possible languages are indicated as the following - only one should be specified: sv, en, etc |
Parameters
Parameter | Description | Type | In |
---|---|---|---|
|
The segment the customer belongs to (listed in Get partner form structure). |
integer |
Json |
|
The legal area the case the customer would like to handle belongs to (potential are listed in Get partner form structure). |
sting | Json |
|
The customers situation (potential are listed in Get partner form structure). |
sting |
Json |
|
The number of co-owners of a company. Just relevant for companies. |
sting |
Json |
|
The potential options are listed as "contact_type" under "legal_areas -> form_types" from Get partner form structure. |
sting |
Json |
|
The name of the customer. |
string |
Json |
|
The customer's e-mail. |
string |
Json |
|
The customer's phone number. |
string |
Json |
|
The swedish personal number. |
interger |
Json |
|
Required for physical meetings. Shouldn't be included for other form of meetings. |
string |
Json |
|
Information when the customer would like to be contacted. |
string |
Json |
|
Meeting type. Possible values: "phone" and "video". |
string |
Json |
|
The date of the meeting. |
date |
Json |
|
The starting time of the meeting. |
string |
Json |
|
The id of the lawyer who will join the meeting. Got from the GET meeting request above. |
integer |
Json |
|
The name of the advisor. It's used for reports and can be set to a static value for example 'Robot'. |
string |
Json |
|
The email of the advisor. It's used for reports and can be set to a static value for example 'robot@partner.com'. |
string |
Json |
|
The phone number to the advisor. The phone number may only have numeric characters. |
string |
Json |
|
The advisor's working group. This is used for reports and can have any type of value for example: 'Stockholm' or 'Call center'. |
string |
Json |
|
The advisor's working subgroup. This used for reports and can have any type of value for example: 'Södermalm' or 'Team 10'. |
string |
Json |
Responses
Code | Description |
---|---|
200 | The contact info is sent and an internal contact ticket has been created. The data is returned in JSON format. |
400 | Required fields missing or incorrect. |