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

# Webhooks & Batch

> Fire configured webhook templates and run multiple operations in a single call.

## fireWebhook

Fires a webhook using a template configured on the dashboard, optionally passing data to populate it.

```lua theme={null}
local result = BloxCord:Invoke("fireWebhook", actor, templateId, data, wait)
```

### Parameters

<ParamField body="actor" type="Player | table | number" required>
  Who is firing the webhook. See [the actor object](/gi-concepts#the-actor-object).
</ParamField>

<ParamField body="templateId" type="string" required>
  The id of the webhook template to fire.
</ParamField>

<ParamField body="data" type="table" required>
  Key/value data used to populate the template. Pass an empty table `{}` if the template needs no data. Non-table values are treated as an empty table.
</ParamField>

<ParamField body="wait" default="false" type="boolean">
  When `true`, the backend waits for the webhook delivery before responding.
</ParamField>

### Returns

<ResponseField name="result" type="table | nil">
  The delivery result on success, or `nil` if the request was rejected or the backend was unreachable.
</ResponseField>

### Example

```lua theme={null}
local BloxCord = game:WaitForChild("BloxCord")

BloxCord:Invoke("fireWebhook", host, "shift-started", {
    host = host.Name,
    players = #game.Players:GetPlayers(),
}, false)
```

***

## apiBatch

Runs multiple operations in a single request. All operations share one actor and are executed sequentially on the backend. This is the most efficient way to perform several writes at once.

```lua theme={null}
local results = BloxCord:Invoke("apiBatch", actor, operations)
```

<Warning>
  A batch may contain at most **20 operations**. Duplicate operations within the same batch are rejected. Each operation's `args` payload is capped at 24 KB.
</Warning>

### Parameters

<ParamField body="actor" type="Player | table | number" required>
  The actor applied to every operation in the batch. See [the actor object](/concepts#the-actor-object).
</ParamField>

<ParamField body="operations" type="object[]" required>
  An array of operation objects to execute in order.

  <Expandable title="operation fields">
    <ParamField body="op" type="string" required>
      The operation name. Allowed values: `setRank`, `logbook.create`, `points.get`, `points.update`, `reputation.get`, `webhook.fire`, `session.getReservations`, `session.startHosting`, `session.updateAttendees`, `session.updateMark`, `session.updateStrike`, `session.updatePhase`, `session.updateSession`.
    </ParamField>

    <ParamField body="args" type="table">
      The arguments for that operation.
    </ParamField>
  </Expandable>
</ParamField>

### Returns

<ResponseField name="results" type="array | nil">
  The per-operation results from the backend on success, or `nil` if the batch was rejected or the backend was unreachable.
</ResponseField>

### Example

```lua theme={null}
local BloxCord = game:WaitForChild("BloxCord")

local results = BloxCord:Invoke("apiBatch", host, {
    {
        op = "points.update",
        args = { userId = "123456789", amount = 5, reason = "Attendance" },
    },
    {
        op = "logbook.create",
        args = { userId = "123456789", type = "warning", reason = "Late" },
    },
})
```
