Authorization
Desearch API authentication
To access the Desearch API, you must include your API key in the request header for authentication. All API endpoints are authenticated using tokens.
Use the following format to add the authorization header to your API Requests.
'Authorization': '<your token>'
To access the Desearch API, you must authenticate your requests using an API key that was generated as defined here. This key grants secure access and ensures proper authorization for each API call. All API endpoints require authentication via tokens.
Authentication Method
Include your API key in the request header using the Authorization header. The correct format is as below.
curl --location 'https://apis.datura.ai/desearch/ai/search' \
--header 'Authorization: dt_$UZA25rX0jLD654y7AGswWvqABCeJHFiCLqqBWPF6abc' \
--header 'Content-Type: application/json' \
--data '{
"date_filter": "PAST_24_HOURS",
"model": "NOVA",
"prompt": "Latest TAO trends",
"streaming": true,
"tools": [
"Twitter Search"
]
}'
import requests
url = "https://apis.datura.ai/desearch/ai/search"
headers = {
"Authorization": "dt_$YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"date_filter": "PAST_24_HOURS",
"model": "NOVA",
"prompt": "Washington Crash",
"response_order": "SUMMARY_FIRST",
"streaming": True,
"tools": ["Twitter Search"]
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const fetch = require('node-fetch');
const url = "https://apis.datura.ai/desearch/ai/search";
const headers = {
"Authorization": "dt_$YOUR_API_KEY",
"Content-Type": "application/json"
};
const data = JSON.stringify({
"date_filter": "PAST_24_HOURS",
"model": "NOVA",
"prompt": "Washington Crash",
"response_order": "SUMMARY_FIRST",
"streaming": true,
"tools": ["Twitter Search"]
});
fetch(url, {
method: "POST",
headers: headers,
body: data
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error("Error:", error));
Securing API Key
Keep your API key confidential and do not expose it in client-side code.
Updated about 11 hours ago