# post\_\_bucket\_{bucketId}\_stats

`POST /bucket/{bucketId}/stats`

*Get Bucket Daily Statistics*

Retrieve daily performance statistics for a specific storage bucket, including uptime percentages, latency metrics, and node status information for a given date.

**Note:** This endpoint respects workspace access controls. Users can only access buckets within their accessible workspaces.

#### TypeScript Client Library

```typescript
public getBucketNodeStats = async (bucketId: string, data: GetBucketNodeStatsRequest): Promise<GetBucketNodeStatsResponse> => {
  return this.makeRequest<GetBucketNodeStatsResponse>(`bucket/${bucketId}/stats`, 'POST', data);
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X POST https://backend.flashback.tech/bucket/{bucketId}/stats \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
POST https://backend.flashback.tech/bucket/{bucketId}/stats HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: application/json
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const inputBody = '{
  "day": "2024-01-15T00:00:00.000Z"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/bucket/{bucketId}/stats',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post 'https://backend.flashback.tech/bucket/{bucketId}/stats',
  params: {
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('https://backend.flashback.tech/bucket/{bucketId}/stats', headers = headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/bucket/{bucketId}/stats");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://backend.flashback.tech/bucket/{bucketId}/stats", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

#### Parameters <a href="#post__bucket_-bucketid-_stats-parameters" id="post__bucket_-bucketid-_stats-parameters"></a>

| Name     | In   | Type   | Required | Description                      |
| -------- | ---- | ------ | -------- | -------------------------------- |
| bucketId | path | string | true     | Unique identifier of the bucket  |
| body     | body | object | true     | Request body containing the date |

> Body parameter

```json
{
  "day": "2024-01-15T00:00:00.000Z"
}
```

#### Parameters <a href="#post__bucket_-bucketid-_stats-parameters" id="post__bucket_-bucketid-_stats-parameters"></a>

| Name  | In   | Type   | Required | Description                                             |
| ----- | ---- | ------ | -------- | ------------------------------------------------------- |
| body  | body | object | true     | none                                                    |
| » day | body | string | true     | Date for which to retrieve statistics (ISO 8601 format) |

> Example responses

> 200 Response

```json
{
  "success": true,
  "nodeStats": [
    {
      "ip": "192.168.1.100",
      "host": "*-us-east-1-aws.flashback.tech",
      "perc_uptime": 99.5,
      "avg_latency_ms": 45,
      "version": "1.2.3",
      "node_status": "ONLINE",
      "last_updated": "2024-01-15T10:30:00Z",
      "last_latency_ms": 42
    }
  ]
}
```

#### Responses <a href="#post__bucket_-bucketid-_stats-responses" id="post__bucket_-bucketid-_stats-responses"></a>

| Status | Meaning                                                          | Description                       | Schema |
| ------ | ---------------------------------------------------------------- | --------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)          | Statistics retrieved successfully | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Invalid date format               | Inline |
| 403    | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)   | Insufficient permissions          | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)   | Bucket or user not found          | Inline |

#### Response Schema <a href="#post__bucket_-bucketid-_stats-responseschema" id="post__bucket_-bucketid-_stats-responseschema"></a>

Status Code **200**

| Name                 | Type              | Required | Restrictions | Description                                     |
| -------------------- | ----------------- | -------- | ------------ | ----------------------------------------------- |
| » success            | boolean           | false    | none         | Operation success status                        |
| » nodeStats          | \[object]         | false    | none         | Array of daily node statistics                  |
| »» ip                | string            | false    | none         | IP address of the node                          |
| »» host              | string            | false    | none         | Hostname pattern for the node                   |
| »» perc\_uptime      | number            | false    | none         | Percentage of time the node was online          |
| »» avg\_latency\_ms  | number            | false    | none         | Average latency to the node in milliseconds     |
| »» version           | string            | false    | none         | Software version running on the node            |
| »» node\_status      | string            | false    | none         | Current operational status of the node          |
| »» last\_updated     | string(date-time) | false    | none         | Timestamp of last status update                 |
| »» last\_latency\_ms | number            | false    | none         | Most recent latency measurement in milliseconds |

Status Code **400**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

Status Code **403**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

Status Code **404**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth


---

# 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://docs.flashback.tech/support-reference/platform-api-reference/storage-apis/bucket-management/post__bucket_-bucketid-_stats.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.
