Docs
API Reference

API Reference

If you need any custom integration, you can use our chat API. You need the API key for that. You can get the API key from Settings tab. If the Key is not generated, click on Generate button and copy the key.

⚠️

Do not expose your API keys and tokens in the frontend. Instead, use a backend service to proxy your API calls. This will help to protect your credentials from attackers.

Parameters

ParameterTypeDescriptionRequired
projectId *stringFrom the settings page under API sectionYes
question *stringQuestion you want to askYes
conversationIdstringChat ID to have continuous conversationOptional
userIdstringIdentify users with email or unique id which can be viewed in chat historyOptional
additionalDetailsjsonAdd custom fields like email , name and other ids you would like to see in the chat historyOptional

Example

 
fetch('https://docsai.app/api/v1/chat', {
    method: 'POST',
    body: JSON.stringify({ projectId: '<project_id>', question: '<your_question>' }),
    headers: {
        'Authorization': 'Bearer <api_key>',
        'Content-Type': 'application/json'
    }
})

Sucess response

{
    "tokens": 724,
    "answer": "The answer to your question",
    "sources": "https://docsai.app/pricing,https://docsai.app/dashboard,https://docsai.app",
    "limitReached": false,
    "conversationId": "clgyrh8vm0003u1kix801l4qz"
}

Error response

If your projectId is not valid

{ "message": "project not found" }

If Bearer token is not valid

{ "message": "unauthourised request" }

The request body data is not in the expected format or there was an error on our servers. If you think there is something wrong with the servers please contact us hey@docsai.app

{ "message": "Something happened! Please check your data validity or contact help" }