API Endpoints
Prerequisites
- An active Eden AI account with an API key.
- Familiarity with making HTTP requests.
Step 1: Set Up Authorization
To use Eden AI’s API, include an Authorization header with a Bearer token in your HTTP requests. This token authenticates your access to the platform’s services.
Step 2: Execute a Workflow (POST Request)
To start a workflow execution, make a POST request to the endpoint, passing in the required files and a payload of workflow-specific parameters.
Request Details
- Endpoint: https://api.edenai.run/v2/workflow/<workflow_id>/execution/
- Method: POST
- Headers:
- Authorization: Bearer YOUR_API_TOKEN
- Files: Attach files IF required by your workflow, e.g., my_file.
- Data Payload: Pass in key-value pairs relevant to the workflow, such as prompt, input_text, etc.
Example Request
Here's a general structure for the POST request:
POST <https://api.edenai.run/v2/workflow/>\<workflow_id>/execution/
Headers:
Authorization: Bearer YOUR_API_TOKEN
Files:
my_file: /path/to/your/my_file.pdf
Payload (JSON or form data):
{
"prompt": "<string value>",
"text_input_1": "<string value>"
}
Replace <workflow_id> with your actual workflow ID and YOUR_API_TOKEN with your API token. Update file paths and payload values based on your specific workflow needs.
Step 3: Retrieve Workflow Execution Results (GET Request)
After executing the workflow, retrieve results by making a GET request with the execution_id received from the initial POST response.
Request Details
- *Endpoint:** https://api.edenai.run/v2/workflow/<workflow_id>/execution/<execution_id>/
- Method: GET
- Headers:
- Authorization: Bearer YOUR_API_TOKEN
Example Request
Use this general structure for the GET request:
GET <https://api.edenai.run/v2/workflow/>\<workflow_id>/execution/\<execution_id>/
Headers:
Authorization: Bearer YOUR_API_TOKEN
Replace <workflow_id>, <execution_id>, and YOUR_API_TOKEN with your workflow ID, the specific execution ID, and your API token.
Summary
POST request: Executes the workflow by sending files and a data payload.
GET request: Retrieves the results using the execution_id.
For advanced settings and details, refer to the Eden AI Documentation. This quickstart guide provides the essentials for starting with Eden AI Workflows.
Updated about 1 month ago