Skip to content

Using the API Directly

Overview

Each service in the Mira platform, referred to as a "flow", is accessible via a dedicated API endpoint. This document outlines how to interact directly with these endpoints.

Endpoint Structure

For a service named @klok/qna, the API endpoint would be structured as follows:

https://console.mira.network/v1/@klok/qna

Request Format

Input

The input to a flow is provided as a JSON payload in a POST request. Here is an example of a typical payload:

json
{
  "query": "What is the capital of France?",
  "options": ["Paris", "Lyon", "Marseille"]
}

Output

The response from the API will also be in JSON format, providing the results of the executed flow.

json
{
  "answer": "Paris"
}

Example Request

Using curl to make a request:

bash
curl -X POST https://console.mira.network/v1/@klok/qna \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"What is the capital of France?", "options":["Paris", "Lyon", "Marseille"]}'

This will return the response in JSON format as described in the Output section.