# Test a storage connection

`POST /api/v1/storages/{storage}/test`

Connects with the stored settings and credentials and records the outcome on the storage (`last_tested_at`, `last_test_status`). For an S3 storage that is reachable it also reads whether the bucket has Object Lock turned on and stores it (`object_lock_enabled`); a failed Object Lock check does not fail the test and keeps the stored value.

## Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| storage | integer | yes | The ID of the storage. Example: `3`. |

## Response

### 200

The outcome of the connection test, also recorded on the storage.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | yes | One of: `Storage connection test succeeded.`, `Storage connection test failed.`. |
| storage_id | integer | yes |  |
| success | boolean | yes |  |
| error | string | yes | Why the test failed, for example `Could not connect to the bucket: access denied.`; null when it succeeded. Nullable. |
| last_tested_at | string · date-time | yes | Nullable. |
| last_test_status | string | yes | Nullable. One of: `success`, `failed`, `null`. |
| object_lock_enabled | boolean | yes | The stored Object Lock state after this test: null for SFTP and FTP storages and until an S3 bucket has been checked. Nullable. |
| object_lock_error | string | yes | Why the Object Lock check failed, for example `Access Denied`; null when it was read or not attempted. Nullable. |

### 401

The request carries no valid token: the `Authorization: Bearer` header is missing, or its token is unknown, revoked or past its expiry date. Send a current personal access token.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | yes | Always `Unauthenticated.`. |

### 403

The token may not do this. The `message` says why: `This token lacks the required ability.` (a `read` token), `Your role does not permit this action.` (its owner is not an Admin or Operator in the client), `This account is disabled.`, `This token is not bound to a client you belong to.`, or `Client suspended`.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | yes | What went wrong. |

### 404

Not found

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | yes | What went wrong. |

### 429

More than 120 requests a minute for this user. Wait the seconds in `Retry-After`, then retry.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | yes | What went wrong. |

## Request example

```bash
curl -X POST 'https://app.clokeep.com/api/v1/storages/3/test' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Accept: application/json'
```

## Response example (200)

```json
{
  "message": "Storage connection test succeeded.",
  "storage_id": 3,
  "success": true,
  "error": null,
  "last_tested_at": "2026-11-19T09:30:00+00:00",
  "last_test_status": "success",
  "object_lock_enabled": true,
  "object_lock_error": null
}
```

## Response example (401)

```json
{
  "message": "Unauthenticated."
}
```

## Response example (403)

```json
{
  "message": "This token lacks the required ability."
}
```

## Response example (404)

```json
{
  "message": "No query results for model [App\\Models\\Storage] 3"
}
```

## Response example (429)

```json
{
  "message": "Too Many Attempts."
}
```
