Creating Actions

Create an Action

Define a reusable action with multiple steps.

Endpoint

POST /actions/v1
POST
/actions/v1
curl -X POST https://api.case.dev/actions/v1 \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Deposition Analysis Pipeline",
  "description": "Summarize deposition and extract key admissions",
  "webhook_id": "webhook_abc123",
  "definition": {
    "steps": [
      {
        "id": "summarize",
        "service": "workflows",
        "workflow_id": "workflow_uuid",
        "input": {
          "text": "{{input.transcript}}"
        },
        "options": {
          "max_tokens": 2000
        }
      },
      {
        "id": "extract_admissions",
        "service": "llm",
        "input": {
          "text": "From this summary, extract key admissions: {{steps.summarize.output.text}}"
        },
        "options": {
          "model": "anthropic/claude-sonnet-4.5",
          "max_tokens": 500
        }
      }
    ]
  }
}'

Action Payload (JSON & YAML)

Use either format when creating actions. JSON is perfect for programmatic calls, while YAML is great for declarative infrastructure.

{
  "name": "Deposition Analysis Pipeline",
  "description": "Summarize deposition and extract key admissions",
  "webhook_id": "webhook_abc123",
  "definition": {
    "steps": [
      {
        "id": "summarize",
          "service": "workflows",
          "workflow_id": "workflow_uuid",
        "input": {
          "text": "{{input.transcript}}"
        },
        "options": {
          "max_tokens": 2000
        }
      },
      {
        "id": "extract_admissions",
        "service": "llm",
        "input": {
          "text": "From this summary, extract key admissions: {{steps.summarize.output.text}}"
        },
        "options": {
          "model": "anthropic/claude-sonnet-4.5",
          "max_tokens": 500
        }
      }
    ]
  }
}

Request Fields

  • name (required): Action name
  • description (optional): What the action does
  • webhook_id (optional): Webhook endpoint to notify on completion
  • definition (required): Action steps configuration
    • steps (required): Array of steps to execute

Understanding Input & Output Data

Actions receive an input object every time you execute them. Each top-level key becomes addressable inside your steps with {{input.<field>}}, and step outputs become available via {{steps.<step_id>.output}}.

Example execution payload:

{
  "input": {
    "case_id": "case_2024_001",
    "transcript_url": "https://assets.case.dev/depo-0425.pdf",
    "notify_email": "paralegal@firm.com"
  }
}

File paths and storage

  • Use vault steps to persist output files. The filename field accepts full paths, so you can nest content by case, date, or any taxonomy. For example: "filename": "{{input.case_id}}/reports/{{timestamp}}-summary.json".
  • Any data you store on a step (e.g., LLM responses) can be reused later via {{steps.<id>.output}}. Combine this with vault storage to write summaries, transcripts, or structured JSON directly to {{input.case_id}}/....
  • Need external assets? Pass URLs or S3 keys in the input object (like transcript_url above) and consume them inside steps with {{input.transcript_url}}.

Accessing outputs

  • Every step produces an output object. LLM steps surface text in steps.<id>.output.content, workflows expose structured JSON, and vault uploads return metadata such as object IDs.
  • When the action finishes, the final API response will include the last step outputs plus a step_results map so you can inspect or download generated files programmatically.

Example Request

curl -X POST https://api.case.dev/actions/v1 \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Document Processing Pipeline",
    "description": "OCR document, summarize with workflow, store in vault",
    "definition": {
      "steps": [
        {
          "id": "ocr_document",
          "service": "ocr",
          "input": {
            "document_url": "{{input.document_url}}"
          }
        },
        {
          "id": "summarize",
          "service": "workflows",
          "workflow_id": "deposition_summary_workflow_id",
          "input": {
            "text": "{{steps.ocr_document.output.text}}"
          }
        },
        {
          "id": "store",
          "service": "vault",
          "action": "upload",
          "vault_id": "vault_123",
          "input": {
            "filename": "summary.txt",
            "content": "{{steps.summarize.output.text}}"
          }
        }
      ]
    }
  }'

Example Response

{
  "id": "action_abc123",
  "organizationId": "org_xyz",
  "name": "Document Processing Pipeline",
  "description": "OCR document, summarize with workflow, store in vault",
  "definition": {
    "steps": [...]
  },
  "webhookEndpointId": null,
  "isActive": true,
  "version": 1,
  "createdAt": "2024-11-06T20:00:00Z",
  "updatedAt": "2024-11-06T20:00:00Z"
}

Next Steps