Code Examples

Implementation examples in various programming languages

Integrate Proventra in your preferred programming language.

JavaScript/TypeScript

Using fetch:

const response = await fetch(
  'https://api.proventra.com/api/v1/analyze',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      text: 'Your text here',
      sanitize: true
    })
  }
)

const result = await response.json()
console.log(result.unsafe) // false
console.log(result.sanitized) // sanitized text

Python

Using requests:

import requests

response = requests.post(
    'https://api.proventra.com/api/v1/analyze',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    json={
        'text': 'Text to analyze',
        'sanitize': True
    }
)

result = response.json()
print(result['unsafe'])  # False
print(result['sanitized'])  # sanitized text

Next Steps