Whether you’re a developer, non-coder or business user, you will easily be able to understand how to start using Bodyguard’s API.
The API closely follows REST semantics. It uses JSON to encode objects and relies on standard HTTP codes to signal operation outcomes.
The API documentation below describes all use cases. We recommend that you use graphical tools like Postman to test our API with your own analysis.
Requirements
Make sure that you have already created an account on Bodyguard (contact us at business@bodyguard.ai) and have access to the dashboard.
Analyze content in less than 5 minutes
Step 1: Obtain your API key and Channel ID
Your account is represented as an organization and you can create as many sources you need. Then, you have to create a channel and generate a specific API key.
Step 2: Make a test API request
To check that your integration is working correctly, make a test API request using your API Key and channel ID to create an analysis request.
Endpoint
https://bamboo.bodyguard.ai/api
All API requests must be authenticated and made over TLS
Using REST
The following example is written in Javascript.
More languages snippets (Python, Go, PHP, Java, etc) will be available soon.
import request from 'request'
const options = {
method: 'POST',
url: 'https://bamboo.bodyguard.ai/api/analyze',
headers: {
'X-Api-Key': '__GENERATED_API_KEY__',
'Content-Type': 'application/json'
},
body: JSON.stringify({
channelId: "__GENERATED_CHANNEL_ID__",
contents: [
{
text : "Einstein is an asshole",
publishedAt: "2022-10-07T11:34:26.312Z"
}
]
})
}
request(options, (error, response) => {
if (error) {
throw new Error(error)
}
console.log(response.body)
});
Bodyguard returns an analysis object in response of your API request :
{
"data": [
{
"text": "Einstein is an asshole",
"reference": "bodyguard/fc9dec31-695d-47cc-b919-68dd711bd607",
"type": "HATEFUL",
"severity": "HIGH",
"recommendedAction": "REMOVE",
"meta": {
"directedAt": "SINGLE_PERSON",
"classifications": [
"INSULT"
]
},
"language": "en",
"analyzedAt": "2022-10-07T11:34:29.873Z",
"publishedAt": "2022-10-07T11:34:26.312Z"
}
]
}
What's next?
The power of Bodyguard's API allows you to get more than a simple analysis. From message batches to contextual informations (authors, etc) there is so much to discover.
Don't hesitate to take a look at this documentation to unleash the power of our API.