# Inicializar acción personalizada

**POST**\
`https://api.anunzi.net/v2/actions/initialize`

Initialize a previously created custom action by providing its unique `action_id`. You can also dynamically assign variables to the action.

***

#### **Body Parameters**

| Parameter   | Type             | Required | Description                                                                |
| ----------- | ---------------- | -------- | -------------------------------------------------------------------------- |
| `action_id` | string           | Yes      | The unique ID of the action to initialize.                                 |
| `variables` | array of objects | No       | Key-value pairs of dynamic variables to be assigned during initialization. |

**Variables Object**

| Parameter | Type   | Required | Description                         |
| --------- | ------ | -------- | ----------------------------------- |
| `key`     | string | Yes      | The name of the variable.           |
| `value`   | string | Yes      | The value assigned to the variable. |

***

#### **Example Request (cURL)**

```bash
curl --request POST \
     --url https://api.anunzi.net/v2/actions/initialize \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'Authorization: Bearer API_KEY' \
     --data '
{
  "action_id": "515615123123x15616515",
  "variables": [
    {"key": "customer_name", "value": "David"},
    {"key": "appointment_date", "value": "2024-03-28"}
  ]
}
'
```

***

#### **Example Response (200 OK)**

```json
{
  "status": "success",
  "response": {
    "answer": "Action initialized."
  }
}
```

***

#### **Status Codes**

| Code | Description                                 |
| ---- | ------------------------------------------- |
| 200  | Action initialized successfully.            |
| 400  | Bad Request. Invalid or missing parameters. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.anunzi.net/api-widgets/trabajar-con-la-api-de-llamadas/actions/initialize-custom-action.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
