Safe AI Workbench Developer Docs

Quick Start

Make your first API call in 5 minutes

Step 1: Get Your API Key

Your API key is available on your dashboard. It looks like this:

gha_1234567890abcdefghijklmnop
⚠️ Keep your API key secure! Never share it in public repositories or client-side code.

Step 2: Make Your First Request

Choose your language and copy the code below:

cURL

curl https://api.guardianhealth.dev/api/ai/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "conversationId": "new",
    "taskId": "meeting-summarizer",
    "variables": {
      "content": "Today we discussed Q3 targets and budget allocation..."
    }
  }'

JavaScript (fetch)

const response = await fetch('https://api.guardianhealth.dev/api/ai/chat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    conversationId: 'new',
    taskId: 'meeting-summarizer',
    variables: {
      content: 'Today we discussed Q3 targets and budget allocation...'
    }
  })
});

const result = await response.json();
console.log(result.completion);

Python (requests)

import requests

response = requests.post(
    'https://api.guardianhealth.dev/api/ai/chat',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'conversationId': 'new',
        'taskId': 'meeting-summarizer',
        'variables': {
            'content': 'Today we discussed Q3 targets and budget allocation...'
        }
    }
)

result = response.json()
print(result['completion'])

Node.js (axios)

const axios = require('axios');

const response = await axios.post('https://api.guardianhealth.dev/api/ai/chat', {
  conversationId: 'new',
  taskId: 'meeting-summarizer',
  variables: {
    content: 'Today we discussed Q3 targets and budget allocation...'
  }
}, {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});

console.log(response.data.completion);
💡 Tip: Replace YOUR_API_KEY with your actual API key from the dashboard.

Step 3: Understand the Response

Successful requests return JSON with the AI-generated completion and metadata:

{
  "completion": "Meeting Summary - Q3 Planning\n\nKey Points:\n- Budget allocation for Q3 reviewed\n- Target metrics established...\n\nAction Items:\n1. Finalize budget by EOW\n2. Schedule team sync next Tuesday",
  "conversationId": "conv_abc123def456",
  "phiDetected": false,
  "policyViolations": [],
  "metadata": {
    "model": "gpt-4o",
    "temperature": 0.7,
    "tokensUsed": 245,
    "taskId": "meeting-summarizer",
    "processingTime": 1.2
  }
}

💡 Key Response Fields:

  • completion - The AI-generated response
  • phiDetected - Whether PHI was found in the input
  • policyViolations - Any policy rules that were triggered