In this guide, you’ll learn how automate you first call by creating a Task through the Opkit API.

Step by Step

To create a task, make a POST request to the endpoint https://api.opkit.co/v1/tasks.

curl -X POST https://api.opkit.co/v1/tasks \
 -H "Authorization: Bearer [api-key]" -H "Content-Type: application/json" \
 --data '{
  "call_template_id": "[template-id]",
  "target_id": "[target-id]",
  "context": [
    {
      "name": "patient name",
      "value": "John Smith"
    },
    {
      "name": "Patient Date of Birth",
      "value": "1992-10-10"
    }
  ],
  "objectives": [
    {
      "name": "insurance_valid",
      "description": "Check if insurance is valid",
      "type": "boolean"
    }
  ]
}'

Remember to replace [api-key], [template-id] and [target-id] with your actual API key, call template ID and target ID respectively. You can find your appropriate call template ID and target ID by making a GET request to https://api.opkit.co/v1/call_templates and https://api.opkit.co/v1/targets respectively.

The POST request will return a response which includes a UUID of the created task.

{
  "id": "22818c08-c6d0-44cb-85c0-12fe9d220d4b",
  "created_at": "2023-10-31T23:39:25Z",
  "call_template_id": [template-id],
  "target_id": [target-id],
  "context": [
    {
      "name": "patient name",
      "value": "John Smith"
    },
    {
      "name": "Patient Date of Birth",
      "value": "1992-10-10"
    }
  ],
  "objectives": [
    {
      "name": "insurance_valid",
      "description": "Check if insurance is valid",
      "type": "boolean"
    }
  ],
  "status": "in_progress"
}