Anecdote API

Anecdote AI Public API Documentation

This document provides documentation for the Anecdote AI Public API.

Authentication

All requests to the API must be authenticated using a Bearer token in the Authorization header.

Authorization: Bearer <YOUR_TOKEN>

A token can be obtained by sending a request to the support team.

Endpoints

The base URL for all endpoints is https://public-api.anecdoteai.com

The following endpoints are available:

  • POST /public/export

  • POST /public/search

  • POST /public/trend

  • POST /public/distribution

  • POST /public/quantify

  • POST /public/deeper-search


Filtering

Many endpoints support a filters parameter in the request body. This allows you to narrow down your requests based on specific criteria.

A filter is a JSON object with the following structure:

  • key (string): The field to filter on.

  • operator (string): The comparison operator (e.g., eq, neq).

  • type (string): The type of filter, such as range or list.

  • value/values/min/max: The value(s) to filter by.

Filter Examples

Range Filter

To filter for entries within a specific date range:

List Filter

To filter for entries from a specific source:


Export

This endpoint is used to export data.

  • Endpoint: POST /public/export

  • Method: POST

Request Body

The request body should be a JSON object with the following fields:

  • export_fields (list of strings, required): A list of fields to include in the export.

  • emails (list of strings, optional): A list of email addresses to send the export to.

  • filters (list of objects, optional): A list of filters to apply to the data.

Example Request


This endpoint performs a search operation.

  • Endpoint: POST /public/search

  • Method: POST

Request Body

The request body is a JSON object with the following fields.

  • search_query (string, optional): The search query.

  • custom_prompt_begin (string, optional): Text to prepend to the summary prompt.

  • custom_prompt_end (string, optional): Text to append to the summary prompt.

  • additional_fields (list of strings, optional): Additional fields to include in the search.

  • filters (array, optional): Filters to apply to the search.

  • limit (integer, optional): The maximum number of results to return.

  • offset (integer, optional): The starting offset for results.

  • sorted_by (array, optional): A list of sort objects.

Example Request


Trend

This endpoint retrieves trend data.

  • Endpoint: GET /public/trend

  • Method: GET

Query Parameters

  • trend_on (string, optional): The field to calculate the trend on. Default: volume.

  • trend_by (string, optional): The aggregation period for the trend (e.g., day, week). Default: -.

Request Body

A GET request to this endpoint can optionally include a JSON body to specify filters.

Example Request


Distribution

This endpoint retrieves distribution data. It can be accessed via GET or POST.

  • Endpoint: /public/distribution

  • Methods: GET, POST

Query Parameters

  • distribution_of (string, optional): Field for which to calculate the distribution. Default: volume.

  • distribution_by (string, optional): Field to group the distribution by. Default: -.

  • stacked_by (string, optional): Field for stacking in the distribution. Default: -.

Request Body (GET)

The GET request can optionally contain a body with a search query and filters.

Example Request (GET)

Request Body (POST)

The POST request accepts a full search request body, allowing for more complex queries.

Example Request (POST)


Quantify

This endpoint is used for quantitative analysis.

  • Endpoint: POST /public/quantify

  • Method: POST

Request Body

The request body contains main_query, main_filters, secondary_query, and secondary_filters.

Example Request


This endpoint performs a more in-depth, agent-based search.

  • Endpoint: POST /public/deeper-search

  • Method: POST

Request Body

The request body is similar to the Search endpoint but is designed for more complex, conversational queries that an agent can break down.

Example Request

Last updated