Docs
Metafog API Documentation

Metafog API Documentation

How to use Metafog AI search API.

Overview

The Metafog AI Search API allows you to perform advanced AI-powered searches to retrieve structured or unstructured information. Use this API to query various topics, trends, or historical data, and receive responses in your preferred format.

Endpoint

Base URL:
https://api.metafog.io/search

Authentication

The API requires a Bearer token for authentication. You must include your API key in the Authorization header.

Auth Header

Authorization: Bearer YOUR_API_KEY

Request Format

All requests to the API should use the POST method and include the following:

Headers

Header NameValueDescription
AuthorizationBearer YOUR_API_KEYAPI key for authentication.
Content-Typeapplication/jsonSpecifies JSON format for the request.

Body

The request body should be in JSON format and include the following parameters:

ParameterTypeRequiredDescription
querystringYesThe query string you want to search.
formatstringNoOutput format. Supported values are JSON or MARKDOWN. Default: MARKDOWN
streambooleanNoStreaming response or not. Default: false

Sample Request

Here's an example cURL request to the API:

curl -X POST "https://api.metafog.io/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "query": "DOGE coin price in last 7 days", 
      "format": "JSON"
      }'

Example with response_format (Coming soon):

curl -X POST "https://api.metafog.io/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "query": "EU privacy regulations for AI", 
      "format": "JSON",
      "response_format": "{\"summary\":\"brief overview of the situation\",\"regulations\":[\"list of key regulations\"],\"timeline\":\"expected implementation dates\",\"sources\":[\"source urls\"]}"
      }'

Responses

The API responds in either JSON or Markdown format depending on your request:

For Markdown Output

{
    "response": "## Dogecoin Price Analysis\nOver the past 7 days, Dogecoin (DOGE) has shown moderate volatility...\n\n*Additional markdown formatted content*"
}

For JSON Output

{
    "price_data": {
        "current_price": 0.0853,
        "price_change_percentage_7d": 0.93,
        "daily_prices": [
            {"date": "2023-06-01", "price": 0.0845},
            {"date": "2023-06-02", "price": 0.0849},
            {"date": "2023-06-03", "price": 0.0850},
            {"date": "2023-06-04", "price": 0.0847},
            {"date": "2023-06-05", "price": 0.0851},
            {"date": "2023-06-06", "price": 0.0852},
            {"date": "2023-06-07", "price": 0.0853}
        ]
    }
}

For JSON with response-format

{
    "summary": "The EU has introduced comprehensive regulations addressing AI systems with focus on transparency and data protection.",
    "regulations": [
        "AI Act - Categorizes AI systems based on risk levels",
        "GDPR integration - Special provisions for AI data processing",
        "Algorithmic transparency requirements"
    ],
    "timeline": "Initial framework adopted in 2023, with full implementation expected by 2025",
    "sources": [
        "europa.eu/ai-legislation",
        "ec.europa.eu/digital-strategy"
    ]
}

Error Response

{
  "heading": "Error Type",
  "error": "Detailed error message"
}

Status Codes

CodeDescription
200Success
400Bad Request (e.g., missing parameters)
401Unauthorized (Invalid API key)
500Internal Server Error
502Provider Error
503Service Unavailable (Network at capacity)

Support

For support or questions, reach out to Metafog Support.