API Endpoints

Modified on Fri, 13 Oct 2023 at 10:09 AM

How the API endpoint works

An API endpoint is a way of accessing an AI model or data hosted on aiXplain through a web address. It allows you to use the model or data in your own applications or code editors without having to download or install anything. In this article, we will explain how the API endpoint works and how you can use it with aiXplain.com models.

Understanding API Endpoints

 An API endpoint comprises three fundamental components:

  • Base URL: This is aiXplain.com's address where the model or data resides. It consistently starts with https://api.aixplain.com/.

  • Path: The unique identifier for the model or data within aiXplain.com. It could be a model ID, pipeline ID, or data ID. 

For instance, models/sentiment represents a sentiment analysis model, pipelines/64d22a6531c56f1636e9fef1 stands for a custom pipeline amalgamating multiple models, and data/corpus signifies a corpus of text data.

  • Query Parameters: These optional settings refine requests or responses. They follow a question mark (?) and are separated by ampersands (&). For instance, text=Hello+world signifies a query parameter specifying input text for a sentiment analysis model.

An example of an API endpoint for a sentiment analysis model on aiXplain.com:


In this instance:

  • The base URL is https://api.aixplain.com/models/ 

  • The path is sentiment 

  • The query parameter is text=Hello+world

Utilizing API Endpoints with Models

To leverage API endpoints with aiXplain.com models, follow these steps:

  1. Model Subscription: Subscribe to the desired model via Discover by clicking the Subscribe button on the model details page. Subscribed models are accessible through your team's Dashboard or the API endpoint.
  2. Generate an API Key: Obtain an API key for authentication purposes. This unique code validates you as an authorized user of aiXplain.com. Generate an API key through your account settings.
  3. API Endpoint Integration: Copy and paste the API endpoint into your application or code editor, tailoring it to your needs. Locate the API endpoint on the model details page or your team's Dashboard. Add your API key as a header parameter using 

'x-api-key': 'API-KEY'// Put full API key here

  1. Request and Response: Make a request to the API endpoint and receive a model response. Request and response formats depend on the model's type and specifications. Detailed information can be found on the model details page or in the documentation.

I hope this article has proven to be both helpful and informative for you. We greatly appreciate your decision to select aiXplain as your AI creation and optimization partner. Should you have any inquiries or feedback, please don't hesitate to reach out to us at your convenience.

Contact us at: support@aixplain.com

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article