# Acknowledge received events — API reference

> Records when this machine received stream events, for the delivery times shown in upfour.

Source: https://upfour.io/docs/api/runner/acknowledge-received-events

[Developers](https://upfour.io/docs/api.md)/[Event stream (up4 CLI)](https://upfour.io/docs/api/runner.md)

Records when this machine received stream events, for the delivery times shown in upfour.

POST https://app.upfour.io/v1/runner/acks

scope runner.stream.read stable [Idempotency-Key supported](https://upfour.io/docs/api/idempotency.md) returns 204

## Parameters

| Field | Type | Description |
| --- | --- | --- |
| `X-Up4-Runner-ID` required | uuid | header parameter · Stable UUID of the runner. |
| `X-Up4-Runner-Name` required | string length 1–64 | header parameter · Printable runner name. |

## Body

`application/json` optional 2 fields

acksRunnerAckPayload[] (required)

Nested fields 2 fields

| Field | Type | Description |
| --- | --- | --- |
| `event_id` optional | string | |
| `received_at_ms` optional | integer | Runner clock for diagnosis. The server uses its own clock for delivery metrics. |

connection_idstring (required)

## Returns

A successful request returns `204` with no response body.

## Errors

Only the errors this operation can return. Every error uses the [same envelope](https://upfour.io/docs/api/responses.md).

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | [bad_request](https://upfour.io/docs/api/errors#code-bad_request) | The request is malformed or fails validation. |

Every call can also return `unauthorized` (401), `rate_limit_exceeded` (429) or `internal_error` (500 / 502). See [Responses and errors](https://upfour.io/docs/api/responses.md).

[PreviousReport a handler run](https://upfour.io/docs/api/runner/report-a-handler-run.md) [NextGet delivery times](https://upfour.io/docs/api/runner/get-delivery-times.md)

## Request

### cURL

```bash
curl -s -X POST "https://app.upfour.io/v1/runner/acks" \
  -H "Authorization: Bearer $UP4_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "acks": [
      {
        "event_id": "00000000-0000-4000-8000-000000000001",
        "received_at_ms": 1795086000165
      }
    ],
    "connection_id": "00000000-0000-4000-8000-000000000002"
  }'
```

### JavaScript

```javascript
const res = await fetch("https://app.upfour.io/v1/runner/acks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UP4_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    acks: [
      {
        event_id: "00000000-0000-4000-8000-000000000001",
        received_at_ms: 1795086000165,
      },
    ],
    connection_id: "00000000-0000-4000-8000-000000000002",
  }),
});
console.log(res.status);
```

### Python

```python
import os
import requests

res = requests.post(
    "https://app.upfour.io/v1/runner/acks",
    headers={"Authorization": f"Bearer {os.environ['UP4_API_KEY']}"},
    json={
        "acks": [
            {
                "event_id": "00000000-0000-4000-8000-000000000001",
                "received_at_ms": 1795086000165,
            },
        ],
        "connection_id": "00000000-0000-4000-8000-000000000002",
    },
)
print(res.status_code)
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"os"
	"strings"
)

func main() {
	payload := strings.NewReader(`{
  "acks": [
    {
      "event_id": "00000000-0000-4000-8000-000000000001",
      "received_at_ms": 1795086000165
    }
  ],
  "connection_id": "00000000-0000-4000-8000-000000000002"
}`)
	req, _ := http.NewRequest("POST", "https://app.upfour.io/v1/runner/acks", payload)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("UP4_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	fmt.Println(res.StatusCode)
}
```

### PHP

```php
<?php
$payload = <<<'JSON'
{
  "acks": [
    {
      "event_id": "00000000-0000-4000-8000-000000000001",
      "received_at_ms": 1795086000165
    }
  ],
  "connection_id": "00000000-0000-4000-8000-000000000002"
}
JSON;

$ch = curl_init("https://app.upfour.io/v1/runner/acks");
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("UP4_API_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n";
curl_close($ch);
```

## Response

### 204

```
Done. The response has no body.
```

### 400

```json
{
  "error": {
    "code": "bad_request",
    "message": "The request is malformed or fails validation.",
    "request_id": "req_…"
  }
}
```
