> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openhermit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GET & PATCH /api/actions/[id]

> Read or update an action's configuration and agent prompts.

## GET — fetch an action

```bash theme={null}
GET https://openhermit.com/api/actions/{action_id}
```

Returns the full action record including all configured prompts.

### Response

```json theme={null}
{
  "action": {
    "id": "uuid",
    "name": "Contact Form",
    "type": "contact_form",
    "tool_name": "contact_form",
    "tool_description": "Send a message to the team",
    "selector": "#contact-form",
    "page_url": "https://example.com/contact",
    "enabled": true,
    "before_prompt": "Have name and email ready.",
    "success_prompt": "Form submitted. We reply within 24h.",
    "failure_prompt": "Try hello@example.com directly.",
    "next_action_url": "https://calendly.com/example/30min",
    "next_action_label": "Book a meeting",
    "created_at": "2025-01-15T10:30:00Z"
  }
}
```

***

## PATCH — update an action

```bash theme={null}
PATCH https://openhermit.com/api/actions/{action_id}
Content-Type: application/json
```

Update any combination of the following fields:

```json theme={null}
{
  "enabled": true,
  "tool_description": "Updated description for agents",
  "before_prompt": "Updated before prompt",
  "success_prompt": "Updated success prompt",
  "failure_prompt": "Updated failure prompt",
  "next_action_url": "https://calendly.com/example/30min",
  "next_action_label": "Book a meeting"
}
```

| Field               | Type           | Description                       |
| ------------------- | -------------- | --------------------------------- |
| `enabled`           | boolean        | Show/hide this action from agents |
| `tool_description`  | string         | How agents understand this action |
| `before_prompt`     | string \| null | Shown to agent before acting      |
| `success_prompt`    | string \| null | Returned after success            |
| `failure_prompt`    | string \| null | Returned after failure            |
| `next_action_url`   | string \| null | URL to chain agents to next       |
| `next_action_label` | string \| null | Label for the next action         |

### Response

```json theme={null}
{
  "success": true,
  "action": { "...updated fields..." }
}
```

### Authentication

Both endpoints require the user to be authenticated via Supabase session cookie. They are dashboard-facing — not designed for cross-origin use.
