REST API Integration

Integrate Velatir directly into your applications using our REST API for complete control over approval workflows.

Base URL

https://api.velatir.com/v1

Authentication

All API requests require an API key in the Authorization header:
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://api.velatir.com/v1/review-tasks

Basic Integration Flow

1

Create Review Task

Submit AI request for approval evaluation
2

Poll for Status

Check task status until decision is made
3

Handle Response

Process approved, declined, or change requested outcomes

Core Endpoints

Create Review Task

POST /review-tasks
{
  "functionName": "send_marketing_email",
  "args": {
    "recipient": "[email protected]",
    "template": "monthly_newsletter"
  },
  "description": "Send personalized newsletter",
  "llmExplanation": "Using customer preferences for content",
  "metadata": {
    "campaign_id": "q4_2024",
    "user_id": "12345"
  }
}

Get Task Status

GET /review-tasks/{taskId}
{
  "id": "task_12345",
  "status": "approved",
  "assessments": [
    {
      "policyId": "gdpr_policy",
      "compliant": true,
      "riskLevel": "medium",
      "confidence": 0.95,
      "tags": ["#PersonalData", "#Marketing"]
    }
  ]
}

Alternative Integration Options

If you prefer not to use the REST API directly, we also provide:

Webhook Integration

Receive real-time notifications when decisions are made:

Setup Webhook

curl -X POST https://api.velatir.com/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/velatir-webhook",
    "events": ["task.completed", "task.requires_intervention"]
  }'

Handle Webhook

app.post('/velatir-webhook', (req, res) => {
  const { event, taskId, status, data } = req.body;
  
  if (event === 'task.completed') {
    if (status === 'approved') {
      // Proceed with operation
      executeApprovedAction(data);
    } else {
      // Handle decline or change request
      handleRejection(data);
    }
  }
  
  res.status(200).send('OK');
});