API Reference (V1)

Updated on April 21, 2024

The Mirage API lets you process AI inference tasks on-demand.

While integrating the REST API, you may be interested in the following guides:


Transcribein Tasks

Get Transcribe Languages

GET
/v1/task/transcribe/languages

List all languages that are available for transcription.

Response Data
reason
string
data
object
languages
object

Map of supported locale codes

  • GEThttps://api.mirage-ai.com/v1/task/transcribe/languages
HTTP
Request
(loading)
Response
(loading)

Transcribe Speech

POST
/v1/task/transcribe/speech{?stream}

Transcribe speech from an audio file to text.

URI Parameters
stream
stringOptional

Can be set to stream the response using SSE

Request Body
locale
objectRequired

Locales to transcribe between

to
stringRequired

Locale code to transcribe to

media
objectRequired

Media file to transcribe

type
stringRequired

Media file MIME type

url
stringRequired

URL of the audio file to be transcribed

  • POSThttps://api.mirage-ai.com/v1/task/transcribe/speech
HTTP
Request
(loading)
Response
(loading)

Answerin Tasks

Answer Prompt

POST
/v1/task/answer/prompt

Answer a given prompt.

Request Body
prompt
stringRequired

Question to generate an answer against

model
enum[string]Optional

Model size (small is faster, large is more qualitative)

Values

  • small
  • medium
  • large
  • POSThttps://api.mirage-ai.com/v1/task/answer/prompt
HTTP
Request
(loading)
Response
(loading)

Answer Question

POST
/v1/task/answer/question{?stream}

Answer a given question using previously indexed data.

URI Parameters
stream
stringOptional

Can be set to stream the response using SSE

Request Body
question
stringRequired

Question to generate an answer against

answer
objectOptional

Answer prefill data

start
stringOptional

Start of answer text (answer text prefix)

system
stringOptional

System prompt used to generate the answer (eg. Speak in a friendly way)

quality
numberOptional

Quality threshold of generated answer (in percent, from 0 to 100)

locale
objectOptional

Locales to answer between

from
stringRequired

Locale code to answer from

context
objectRequired

Context data used to enrich answering

source
stringOptional

Source tag for the ingested item (eg. helpdesk)

primary_id
stringRequired

Primary identifier (eg. team identifier)

filters
objectOptional

Advanced filters (note that simple filters override advanced filters if they collide)

secondary_id
objectOptional

Filter on secondary identifier

include
array[string]Optional

Included values

exclude
array[string]Optional

Excluded values

tertiary_id
objectOptional

Filter on tertiary identifier

include
array[string]Optional

Included values

exclude
array[string]Optional

Excluded values

source
objectOptional

Filter on source identifier

include
array[string]Optional

Included values

exclude
array[string]Optional

Excluded values

conversation
objectRequired

Curent conversation

messages
array[object]Required

List of messages for conversation

from
enum[string]Required

Message sender

Values

  • customer
  • agent
text
stringRequired

Message text

model
enum[string]Optional

Model size (small is faster, large is more qualitative)

Values

  • small
  • medium
  • large
  • POSThttps://api.mirage-ai.com/v1/task/answer/question
HTTP
Request
(loading)
Response
(loading)

Summarizein Tasks

Summarize Paragraphs

POST
/v1/task/summarize/paragraphs

Summarize given paragraphs.

Request Body
paragraphs
array[object]Required

List of paragraphs to summarize

text
stringRequired

Paragraph text

  • POSThttps://api.mirage-ai.com/v1/task/summarize/paragraphs
HTTP
Request
(loading)
Response
(loading)

Summarize Conversation

POST
/v1/task/summarize/conversation

Summarize a given conversation, from a list of messages.

Request Body
transcript
array[object]Required

Transcript of conversation to summarize

name
stringRequired

Message sender name

text
stringRequired

Message text

  • POSThttps://api.mirage-ai.com/v1/task/summarize/conversation
HTTP
Request
(loading)
Response
(loading)

Categorizein Tasks

Categorize Conversations

POST
/v1/task/categorize/conversations

Categorize multiple conversations, from a list of messages for each individual conversation.

Request Body
conversations
array[object]Required

Conversations to categorize

transcript
array[object]Required

Transcript of conversation to categorize

from
enum[string]Required

Message sender

Values

  • customer
  • agent
text
stringRequired

Message text

  • POSThttps://api.mirage-ai.com/v1/task/categorize/conversations
HTTP
Request
(loading)
Response
(loading)

Rankin Tasks

Rank Question

POST
/v1/task/rank/question

Ranks results based on a given question.

Request Body
question
stringRequired

Question to generate ranked results against

context
objectRequired

Context data used to rank results

source
stringOptional

Source tag for the ingested item (eg. helpdesk, required either through simple or advanced filters)

primary_id
stringRequired

Primary identifier (eg. team identifier)

filters
objectOptional

Advanced filters (note that simple filters override advanced filters if they collide)

secondary_id
objectOptional

Filter on secondary identifier

include
array[string]Optional

Included values

exclude
array[string]Optional

Excluded values

tertiary_id
objectOptional

Filter on tertiary identifier

include
array[string]Optional

Included values

exclude
array[string]Optional

Excluded values

source
objectOptional

Filter on source identifier

include
array[string]Optional

Included values

exclude
array[string]Optional

Excluded values

  • POSThttps://api.mirage-ai.com/v1/task/rank/question
HTTP
Request
(loading)
Response
(loading)

Translatein Tasks

Get Translate Languages

GET
/v1/task/translate/languages

List all languages that are available for translation.

Response Data
reason
string
data
object
languages
object

Map of supported locale codes

  • GEThttps://api.mirage-ai.com/v1/task/translate/languages
HTTP
Request
(loading)
Response
(loading)

Translate Text

POST
/v1/task/translate/text

Translate a provided text between two languages.

💡 Note that it is possible to ignore translation for certain parts of the text, by enclosing the text to keep pristine in a <span translate="no"></span> tag. If using such do-not-translate tags, it is required that the type marker is set to html.

Request Body
locale
objectRequired

Locales to translate between

from
stringRequired

Locale code to translate from

to
stringRequired

Locale code to translate to

type
enum[string]Optional

Type of content to translate

Values

  • plain
  • html
text
stringRequired

Text to translate

  • POSThttps://api.mirage-ai.com/v1/task/translate/text
HTTP
Request
(loading)
Response
(loading)

Fraudin Tasks

Fraud Spamicity

POST
/v1/task/fraud/spamicity

Fraud check classification on scammy websites using a website name, domain and email domain.

💡 Note that it is recommended to use the output score. When is_fraud is positive, safe fraud threshold is between 0.95 and 0.97.

Request Body
name
stringRequired

Website name

domain
stringRequired

Website domain

email_domain
stringRequired

Email domain

  • POSThttps://api.mirage-ai.com/v1/task/fraud/spamicity
HTTP
Request
(loading)
Response
(loading)

Contextin Data

Ingest Context Data

POST
/v1/data/context/ingest

Ingest context data into account. This will be used eg. when answering a question.

Request Body
items
array[object]Required

Items to be ingested

operation
enum[string]Optional

Item operation (defaults to index)

Values

  • index
  • reindex
  • delete
primary_id
stringRequired

Primary identifier for the item

secondary_id
stringOptional

Secondary identifier for the item

tertiary_id
stringOptional

Tertiary identifier for the item

text
stringOptional

Text content for the item

timestamp
numberOptional

Timestamp for the item (UNIX format, in milliseconds)

source
stringOptional

Source tag for the item (eg. chat)

metadata
objectOptional

Optional metadata to store alongside the item

  • POSThttps://api.mirage-ai.com/v1/data/context/ingest
HTTP
Request
(loading)
Response
(loading)