API docs

Fundamentals

Welcome to Motific.ai’s API docs!

Motific.ai 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.ai.

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 you 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.ai account.

  2. Navigate to Motifs menu.

  3. To view the Motif details, click on the three dots in the 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.ai that is required by your enterprise application.

  • The Motif-Id is displayed in the API base URL required to send the post request to Motific.ai. 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.ai API in order to integrate your enterprise Gen AI application with Motific.ai and to seamlessly interact with LLMs. All requests to connect to the API for an inference via Motific.ai require user-less access in which you use HTTP Bearer Authentication for every request. You can find the token in the Motific.ai 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 endpoints

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