# What happened in a vault, newest first

```http
GET /api/sync/vaults/{vault}/activity
```

## Authorization

- **session**: `Authorization: Bearer <token>`. The session token from signing in (or the session cookie in a browser on the same origin).

## Path parameters

- **vault** `string` (required)

## Query parameters

- **before** `integer`: Only events older than this id, for the next page

## Response

**200**: It worked

- **events** `array<ActivityEvent>` (required)
  - **id** `number`
  - **at** `number`
  - **actor** `object | null`
    - One of: **Option 1**
      - **id** `string` (required): At most 300 characters
      - **email** `string` (required): At most 300 characters
      - **name** `string` (required): At most 300 characters
  - **action** `string`: At most 60 characters
  - **detail** `string`: At most 100000 characters

Other answers:

- **4XX**: Refused, with a message to show the person

## Example request

````tabs
tab: cURL
```bash
curl -X GET 'https://your-hatch-server/api/sync/vaults/{vault}/activity' \
  -H 'Authorization: Bearer <token>'
```

tab: JavaScript
```js
const res = await fetch("https://your-hatch-server/api/sync/vaults/{vault}/activity", {
  method: "GET",
  headers: {
    Authorization: "Bearer <token>",
  },
})
const data = await res.json()
```

tab: Python
```python
import requests

res = requests.request("GET", "https://your-hatch-server/api/sync/vaults/{vault}/activity", headers={"Authorization": "Bearer <token>"})
data = res.json()
```

tab: Go
```go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, err := http.NewRequest("GET", "https://your-hatch-server/api/sync/vaults/{vault}/activity", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer <token>")
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	fmt.Println(string(data))
}
```

tab: Ruby
```ruby
require "net/http"

uri = URI('https://your-hatch-server/api/sync/vaults/{vault}/activity')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer <token>'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(req)
end
puts res.body
```

tab: PHP
```php
<?php

$ch = curl_init('https://your-hatch-server/api/sync/vaults/{vault}/activity');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer <token>',
    ],
]);

$response = curl_exec($ch);
echo $response;
```

tab: Java
```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://your-hatch-server/api/sync/vaults/{vault}/activity"))
    .header("Authorization", "Bearer <token>")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```
````

## Example response

````tabs
tab: 200
```json
{
  "events": [
    {
      "id": 0,
      "at": 0,
      "actor": {
        "id": "string",
        "email": "string",
        "name": "string"
      },
      "action": "string",
      "detail": "string"
    }
  ]
}
```

tab: 4XX
```json
{
  "message": "string",
  "code": "string",
  "retryable": true,
  "requestId": "string"
}
```
````
