📈 Mafin API Documentation
Welcome to the Mafin API, the financial AI copilot developed by Vectify AI (opens in a new tab). This API enables you to query financial insights with Mafin using natural language. It supports various features like chat history context, real-time streaming responses, and seamless integration with your applications.
- Endpoint:
https://api.vectify.ai/mafin/query
- Method: POST
You can interact with Mafin by passing your query, optionally providing a ticker symbol, chat history, and specifying if you want to stream the response.
Python Usage Example:
import requests
url = "https://api.vectify.ai/mafin/query"
headers = {
"Content-Type": "application/json",
"api_key": "YOUR_API_KEY_HERE"
}
payload = {
"query": "What is the quick ratio of AMD in FY2022?",
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
print("Response:", response.json())
else:
print(f"Error: {response.status_code}, {response.text}")
Authentication
To authenticate your requests to the Mafin API, you must include your API key in the request header. You can contact us to get your API key.
Example Request Header:
{
"api_key": "YOUR_API_KEY_HERE"
}
Request Body
The request body must be formatted as a JSON object and can include the following fields:
Parameters:
query
(required, string):
The main query string that you want Mafin to respond to. This should contain your question or request for information.
Example:"What is the quick ratio of AMD in FY2022?"
-
chat_history
(optional, array of dictionaries):
An array of previous exchanges in the conversation to provide context for the current query. Each entry should be a dictionary with two keys:role
: The role of the speaker, eitheruser
orvectify
.content
: The content of the message exchanged.
chat_history
example:... "chat_history": [ {"role": "user", "content": "Where is the HQ of AMD?"}, {"role": "vectify", "content": "AMD is headquartered in Santa Clara, California."} ] ...
-
streaming
(optional, boolean): Whether to enable real-time streaming of the response. If true, Mafin will stream partial responses as the query is processed. Defaults to false.
Example:false
Example Request:
- Basic Request:
payload = {
"query": "What is the quick ratio of Intel in FY2022?",
}
- With context and non-streaming response:
payload = {
"query": "What is the quick ratio of AMD in FY2022?",
"chat_history": [
{"role": "user", "content": "Where is the HQ of AMD?"},
{"role": "vectify", "content": "AMD is headquartered in Santa Clara, California."}
],
"streaming": false
}