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: 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

(e.g.: https://api.edenai.run/v2/audio/text_to_speech)

  • Method: POST
  • Headers:
    • Authorization: Bearer YOUR_API_TOKEN
  • Files: Attach files IF required by your workflow, e.g., my_file. (only if the API takes file as input)
  • Data Payload: Pass in key-value pairs relevant to the workflow, such as text, providers, language etc.

Example Request

Here's a general structure for the POST request:

POST <https://api.edenai.run/v2/\<feature>/\<subfeature>/  
Headers:  
  Authorization: Bearer YOUR_API_TOKEN

Files:  
  my_file: /path/to/your/my_file.pdf

Payload (JSON or form data):  
  {  
    "providers": "<string value>",  
    "text": "<string value>"
  }

Replace YOUR_API_TOKEN with your API token. Update file paths and payload values based on the API you want to use.

Step 3 : GET Request (Only for asynchronous API)

After doing a POST request to an asynchronous API (ex: Speech-to-text, Video Analysis APIs, OCR multipages, etc.), you need retrieve results by making a GET request with the public_id received from the initial POST response.

Request Details

  • *Endpoint:** <https://api.edenai.run/v2/ <feature>/<subfeature>/<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/\<feature>/\<subfeature>/\<public_id>/  
Headers:  
  Authorization: Bearer YOUR_API_TOKEN

Replace <public_id>, and YOUR_API_TOKEN with your public ID (received in the POST request response) and your API token.

Summary

POST request:
	-  Executes the request by sending files and a data payload and receive results (synchronous APIs)
	-  Executes the request by sending files and a data payload and receive an ID (asynchronous APIs)

GET request: Retrieves the results using the public_id (asynchronous APIs)

For advanced settings and details, refer to the Eden AI Documentation. This quickstart guide provides the essentials for starting with Eden AI AI APIs.