Quickstart Guide
Get CID222 up and running in under 5 minutes. This guide will walk you through the essential steps to start protecting your AI applications.
Prerequisites
- A CID222 account with API access
- Your API key from the dashboard
- An existing LLM provider key (OpenAI, Anthropic, etc.)
Step 1: Get Your API Key
Log in to your CID222 dashboard and navigate to Settings → API Keys. Create a new API key and copy it securely.
Keep Your Key Secure
export CID222_API_KEY="your-api-key-here"
Step 2: Configure Your LLM Provider
Add your LLM provider credentials in the dashboard under Settings → Credentials. CID222 will use these to forward requests to your AI provider.
Step 3: Make Your First Request
Point your existing LLM calls at the CID222 endpoint. The request body is OpenAI-compatible; the response streams back as Server-Sent Events.
1const res = await fetch('https://api.cid222.ai/chat/completions', {2 method: 'POST',3 headers: {4 'Authorization': 'Bearer ' + process.env.CID222_API_KEY,5 'Content-Type': 'application/json',6 },7 body: JSON.stringify({8 model: 'gpt-4o',9 messages: [10 {11 role: 'user',12 content: 'Summarize this customer feedback: Great product! ' +13 'Contact me at john.smith@company.com or 555-123-4567'14 }15 ]16 })17});1819// The response is a Server-Sent Events stream20const reader = res.body.getReader();21const decoder = new TextDecoder();22let answer = '';2324while (true) {25 const { done, value } = await reader.read();26 if (done) break;27 for (const line of decoder.decode(value).split('\n')) {28 if (!line.startsWith('data: ')) continue;29 const data = line.slice(6);30 if (data === '[DONE]') break;31 const event = JSON.parse(data);32 if (event.type === 'content_block_delta') answer += event.delta.text;33 }34}35console.log(answer);
What Happens Behind the Scenes
Step 4: Verify Detection
Check your CID222 dashboard to see the detection logs. You'll see:
- Original content with PII highlighted
- Masked version sent to the LLM
- Entity types detected (EMAIL, PHONE)
- Confidence scores for each detection
Using Sessions (Optional)
For conversational applications, use sessions to maintain context across messages. Session endpoints authenticate with your user JWT, and you choose the model per message:
// Sessions authenticate with your user JWT (from POST /auth/login)const sessionRes = await fetch('https://api.cid222.ai/sessions', {method: 'POST',headers: {'Authorization': 'Bearer ' + jwt,'Content-Type': 'application/json',},body: JSON.stringify({session_name: 'Support chat',user_id: 'user-123'})});const session = await sessionRes.json();// Send messages in the session — choose the model per messageconst messageRes = await fetch(`https://api.cid222.ai/sessions/${session.id}/messages`,{method: 'POST',headers: {'Authorization': 'Bearer ' + jwt,'Content-Type': 'application/json',},body: JSON.stringify({content: 'Hello, I need help with my account',model: 'gpt-4o'})});
Next Steps
- Learn about authentication — Understand JWT tokens and API key management
- Explore the API — Full API reference with all endpoints
- Content Safety Pipeline — How detection and masking works