API docs

Fundamentals

Welcome to Motific’s API docs!

Motific API documentation guides you to integrate your application with the Motif created by your organization. Here, you can also find the information about how to obtain an access token include in a request to Motific.

The API reference gives you details of the endpoints and enables you to interact with the LLM provider and knowledge bases configured to recieve responses for the prompts, all the while adhering to the policies defined in the Motif.

Obtaining access token

Each enterprise application must have a Motif created and obtain the access token. Each application is tied to a Motif and to access the API endpoints should pass the unique access token that the API will validate before returning a response.

Follow the steps below to obtain the access token:

  1. Log in to your Motific account.

  2. Navigate to Motifs menu.

  3. To view the Motif details, click on the three dots in right corner of the Motif.

  4. To obtain the access token, go to API definition tab.

  5. In the API definition tab, you can get the following information:

  • The access token is displayed in the Token field. You can use this token for the Motific that is required by your enterprize application.

  • The Motif-Id is displayed in the API base URL required to send the post request to Motific. The Motif-id can be found at the end of the API base URL. For example: {BASE_URL}/api/v1/apps/{MOTIF_ID}

API structure

Basics

The root url for the API is-https://api.motific.ai..

Response Format

The response format for all requests is a JSON object.

Whether a request succeeded is indicated by the HTTP status code. A 2xx status code indicates success, whereas a 4xx status code indicates failure. When a request fails, the response body is still JSON, but always contains the fields error which you can inspect to use for debugging.

Authentication

Authenticate requests using OAuth access token. This token enables you to access the Motific API in order to integrate your enterprise Gen AI application with Motific and to seamlesslessly interact with LLMs. All requests to connect to the API for an inference via Motific, require userless access in which you use HTTP Bearer Authentication for every request. You can find the token in the Motific API definition screen.

Bearer Authentication


curl -X POST https://<BASE_URL>/api/v1/apps/<MOTIF_ID>/prompts 

-H "Content-Type: application/json" -H "Authorization: Bearer <YOUR_TOKEN_HERE>

Status codes

Status code Reason
200 Request successful

Error codes

Error code Reason
401 Unauthorized access error

Quick API reference

You can quickly look up the API endpoint.

Prompts enpoints

URL HTTP method Functionality
/api/v1/apps/{motific-id}/prompts POST Fetching inference response