Skip to main content

Get Started with API Requests

In this quickstart, you will learn how to call models and pipelines using API requests.

Create an API Key

Create an API key on the Integrations page on Studio.

Models

1. Execute a Model (POST Request)

curl -X POST 'https://models.aixplain.com/api/v1/execute/<model_id>' \
-H 'x-api-key: AIXPLAIN_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"data": "Your input data"}'
Show response
  • Replace TEAM_API_KEY with your actual API key.
  • The -d option sends the input data to the model. If the model accepts multiple inputs, then provide them as a dictionary. For example, to provide text and max_tokens to an LLM use -d '{"text": "Your input text", "max_tokens": 500}'.

2. Retrieve the Result (GET Request)

curl -X GET 'https://models.aixplain.com/api/v1/data/<requestId>' \
-H 'x-api-key: AIXPLAIN_API_KEY' \
-H 'Content-Type: application/json'
Show response

Pipelines

1. Execute a Pipeline (POST Request)

curl -X POST 'https://platform-api.aixplain.com/assets/pipeline/execution/run/<pipeline_id>' \
-H 'x-api-key: AIXPLAIN_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"data": "Your input data"}'
Show response

2. Retrieve the Result (GET Request)

curl -X GET 'https://platform-api.aixplain.com/assets/pipeline/execution/check/<requestId>' \
-H 'x-api-key: AIXPLAIN_API_KEY' \
-H 'Content-Type: application/json' \
Show response

Agent

1. Run an Agent (POST Request)

curl -X POST 'https://platform-api.aixplain.com/sdk/agents/<AGENT_ID>/run' \
-H 'x-api-key: AIXPLAIN_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "<QUERY_TEXT_DATA>",
}'

2. Retrieve the Result (GET Request)

curl -X GET 'https://platform-api.aixplain.com/sdk/agents/<requestId>/result' \
-H 'x-api-key: AIXPLAIN_API_KEY' \
-H 'Content-Type: application/json' \

Convert Curl Commands to Any Language

The cURL Converter tool lets you transform cURL commands into code for your chosen programming language. Paste your cURL command, select a language (e.g., Python, JavaScript, Swift), and get the converted code instantly.

https://curlconverter.com/