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

# Create API Action

> Create webhook/API actions for external integrations.

### Authorizations

<ParamField header="Authorization" type="string" required>
  Enter your ContactSwing JWT Bearer token.
</ParamField>

***

### Request Body

<ParamField body="name" type="string" required>
  Action display name. Example: `My API Action`
</ParamField>

<ParamField body="description" type="string" required>
  Action purpose. Example: `Post API Action`
</ParamField>

<ParamField body="action_timing" type="string" required>
  When to trigger: `"DURING"`
</ParamField>

<ParamField body="type" type="string" required>
  Action type: `"WEBHOOK"`
</ParamField>

<ParamField body="webhook" type="object" required>
  Webhook configuration object

  <ParamField body="url" type="string" required>
    Target API endpoint. Example: `"https://api.publicapis.org/entries"`
  </ParamField>

  <ParamField body="method" type="string" required>
    HTTP method. Example: `"POST"`
  </ParamField>

  <ParamField body="mandatory" type="boolean">
    Require confirmation before execution. Example: `false`
  </ParamField>

  <ParamField body="headers" type="object">
    <ParamField body="Content-Type" type="string">
      Request headers. Example: `{"Content-Type": "application/json"}`
    </ParamField>
  </ParamField>

  <ParamField body="body" type="array">
    Request body definition. Example: `[{"type":"static","values":{"data":"info"}}]`

    <ParamField body="type" type="string">
      Webhook type. Example: `"static"`
    </ParamField>

    <ParamField body="values" type="object">
      <ParamField body="data" type="string">
        Webhook data. Example: `"Information"`
      </ParamField>
    </ParamField>
  </ParamField>

  <ParamField body="static_body" type="string">
    Optional static body payload
  </ParamField>

  <ParamField body="required" type="string[]">
    List of required fields
  </ParamField>

  <ParamField body="response" type="object">
    Response handling configuration

    <ParamField body="prompt" type="string" />
  </ParamField>

  <ParamField body="run_before_call" type="boolean">
    Run pre-call logic. Example: `false`
  </ParamField>

  <ParamField body="type" type="string">
    Webhook type. Example: `"static"`
  </ParamField>
</ParamField>

***

### Response

**201 Created** - Data extraction action created successfully

<ResponseField name="ctx_id" type="string">Request context ID</ResponseField>

<ResponseField name="data" type="object">
  <ResponseField name="action_id" type="string">New extraction action ID</ResponseField>
  <ResponseField name="name" type="string">Action name</ResponseField>
  <ResponseField name="type" type="string">"WEBHOOK"</ResponseField>
</ResponseField>

**400 Bad Request** - Invalid webhook configuration

**401 Unauthorized** - Invalid token
