Managing Actions

List Actions

Get all your action definitions.

Endpoint

GET /actions/v1
GET
/actions/v1
curl -X GET https://api.case.dev/actions/v1 \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json"

Example Request

curl https://api.case.dev/actions/v1 \
  -H "Authorization: Bearer sk_case_your_api_key_here"

Example Response

{
  "data": [
    {
      "id": "action_abc123",
      "name": "Deposition Analysis Pipeline",
      "description": "Summarize and extract key points",
      "isActive": true,
      "version": 1,
      "createdAt": "2024-11-06T20:00:00Z"
    }
  ],
  "total": 1
}

Get Action

Get a specific action definition.

Endpoint

GET /actions/v1/{id}
GET
/actions/v1/action_abc123
curl -X GET https://api.case.dev/actions/v1/action_abc123 \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json"

Execute Action

Execute a saved action with your input data.

Endpoint

POST /actions/v1/{id}/execute
POST
/actions/v1/action_abc123/execute
curl -X POST https://api.case.dev/actions/v1/action_abc123/execute \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "transcript": "Full deposition transcript text...",
    "case_id": "case_2024_001"
  },
  "webhook_id": "webhook_xyz"
}'

Request Fields

  • input (required): Input data for the action
  • webhook_id (optional): Override default webhook for this execution

Supplying inputs

All action executions accept a single input object. Every key in that object is available to your steps via {{input.<key>}}. If you need file locations, pass URLs or S3 keys (e.g., contract_url, audio_url) and read them inside the relevant steps. When writing results, combine those same inputs with helper variables such as {{timestamp}} to build vault paths like {{input.case_id}}/summaries/{{timestamp}}.json.

Synchronous Execution

If no webhook is configured, the action executes synchronously and returns results immediately:

curl -X POST https://api.case.dev/actions/v1/action_abc123/execute \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "question": "What is hearsay in legal terms?"
    }
  }'

Response (immediate):

{
  "execution_id": "exec_xyz789",
  "status": "completed",
  "output": {
    "content": "Hearsay is an out-of-court statement..."
  },
  "step_results": {
    "ask_llm": {
      "output": {...},
      "duration_ms": 1500
    }
  },
  "duration_ms": 1500
}

Asynchronous Execution with Webhooks

If a webhook is configured, the action executes asynchronously and sends results to your webhook:

curl -X POST https://api.case.dev/actions/v1/action_abc123/execute \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "transcript": "Long deposition transcript..."
    },
    "webhook_id": "webhook_xyz"
  }'

Response (immediate):

{
  "execution_id": "exec_xyz789",
  "status": "running",
  "webhook_configured": true,
  "message": "Action execution started. You will receive a webhook notification when complete."
}

Webhook payload (sent when complete):

POST https://your-app.com/webhooks/actions
Headers:
  X-CaseMark-Signature: sha256=abc123...
  X-CaseMark-Event: action.completed
  X-CaseMark-Execution-Id: exec_xyz789

Body:
{
  "event_type": "action.completed",
  "execution_id": "exec_xyz789",
  "action_id": "action_abc123",
  "action_name": "Deposition Analysis Pipeline",
  "status": "completed",
  "output": {...},
  "step_results": {...},
  "duration_ms": 45000,
  "completed_at": "2024-11-06T20:01:00Z"
}

Get Execution Status

Check the status and results of an action execution.

Endpoint

GET /actions/v1/executions/{execution_id}
GET
/actions/v1/executions/exec_xyz789
curl -X GET https://api.case.dev/actions/v1/executions/exec_xyz789 \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json"

Example Response

{
  "id": "exec_xyz789",
  "actionId": "action_abc123",
  "organizationId": "org_xyz",
  "status": "completed",
  "input": {...},
  "output": {...},
  "stepResults": {...},
  "durationMs": 45000,
  "createdAt": "2024-11-06T20:00:00Z",
  "completedAt": "2024-11-06T20:01:00Z"
}

Status values: pending, running, completed, failed


Delete Action

Delete an action definition.

Endpoint

DELETE /actions/v1/{id}
DELETE
/actions/v1/action_abc123
curl -X DELETE https://api.case.dev/actions/v1/action_abc123 \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{}'

  • Webhooks - Configure webhook notifications for async execution
  • Error Handling - Understand how actions handle errors