Introduction
Getting Started
This is the reference for the Legalinc REST API which provides a convenient way to create web and desktop applications that integrate with the services your business provides online. The API will allow you to submit orders, upload documents, and receive update notifications. HTTP response codes are used to indicate API errors. JSON is returned for all responses, and headers must be in JSON format for any methods used.
The best way to get started with the Legalinc API is to POST an order which is one of the most robust calls you can make with the API. The Orders object will provide you with insight into many of the other objects that represent the services you provide to your clients. The documentation here will describe how you can also call these objects independently outside of an order. To POST an order, go to Orders for more information.
Authentication
User authentication is implemented via OAuth 2.0 with an access token that gets passed in the request. You will need to enter a client_secret key as part of setting up your authentication which you can generate in your dashboard under Developer Settings. You will also need to enter your username and password when creating the access token. If at any time you feel this information has been compromised, you have the ability to change the password of the API User.
After you receive your access token you must pass it with any API requests that are not public.
You can pass the access token as a parameter in the header or in the query string on any subsequent API calls.
The header will look like this: 'Authorization' => "Bearer #{@access_token}"
Refer to Generating the Access Token for more details on how to obtain the access token.
Pagination and Sorting
Pagination is available for the Orders object and the following parameters can be used with pagination.
Parameter | |
---|---|
length | Defines the number of orders to be passed |
start | Starting point in the index |
sortColumn | Possible values:
|
sortOrder | Possible values:
|
Sample request with pagination and sorting: https://orders-uat.legalinc.com/api/v1/orders?pagination=true&length=2&start=0&sortColumn=id&sortOrder=asc
Status codes
The Legalinc REST API uses standard HTTP status codes including the following:
Status code | Message |
---|---|
200 | OK Standard response for successful HTTP requests. |
400 | Bad Request Possible reason: the request cannot be fulfilled due to bad syntax or the access token is missing. |
401 | Unauthorized Possible reason: user is not authorized or token is expired. |
404 | Not Found Possible reason: incorrect URL. |
500 | Internal Server Error Server has encountered a situation it doesn't know how to handle. |
Responses that return an error status code (ex. 400 status code) will also return a response body, similar to the following:
{ "error": "invalid_request", "error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \"access token\" parameter." }
A successful response will return data from the request as well as the status code and message inside the same response node as exemplified below.
{ "response": "{data objects ... "message": "The requested operation successfully completed", "code": 200, "success": true }
Examples
Wherever possible, examples are provided throughout the documentation.
Response examples
Some responses can be lengthy due to the objects they return, these examples are collapsed in the documentation. Click the Expand source link to view these responses. Click Collapse source to collapse the example again.
Postman
You may access a collection of requests in Postman to run as examples. To access the collection, click the button when you see it on a page. You will need to use a valid access token to see the results in the UAT environment. Refer to the Generating the Access Token topic for more information.