Step 1: Get your API credentials. You won’t generate API credentials by logging in. Instead, you can create them yourself in your account settings’ API Integration page. While creating the credentials, you’ll assign a display name and choose how long they will stay valid. This could be 7 days, 30 days, 90 days, a custom period, or no expiration at all. The credentials appear only once when you create them, so make sure to save them right away.
Step 2: Get an access token. Use the OAuth 2.0 Client Credentials process to get an access token. Send a POST request to ${server URL}/oauth/token. Include grant_type=client_credentials in the request and use a Basic Authorization header to authenticate it. The response will look like this:
{
"access_token": "${access token}",
"expires_in": 1200,
"token_type": "Bearer",
"api_base_url": "${API base URL}"
}
The access token lasts 3,600 seconds (1 hour). When it expires, you'll need to request a new token because there’s no option to refresh it.
Step 3: Create the endpoint URLs. Use ${api_base_url}/rest/v1 to make requests. To list contracts, send a GET request to {api_base_url}/rest/v1/contracts. To create a contract, use a POST request to the same URL. Make sure every request includes the Authorization: Bearer ${access token} and sets the Content-Type header.
Step 4: Take your first step by making a call. Begin by using a GET request on /contracts. You can narrow down results by using filters like workspace_id, contract_category_code, contract_governing_law_code, counter_party_name, or title. Once you’ve explored the data, move on to creating a new contract. Use a POST request to /contracts. You'll need to include these required fields: workspace_id, contract_file_type (either PRE_EXECUTION or EXECUTED), and the file itself, sent as multipart/form-data.
A quick note about rate limits: If your calls exceed the allowed rate, the system responds with a 429 status. Each response includes headers like X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset to help your integration slow down before hitting the limit. If you need a higher limit to handle your tasks, LegalOn can assist with adjusting that limit.