# Public Cloud › Storage › Object Storage API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Public Cloud product's sections: https://developers.eu.ovhcloud.com/reference/public-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 5 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/object-storage/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/storage/object-storage.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/storage/object-storage.json?format=openapi3

## Operations

- `GET /publicCloud/project/{projectId}/storage/object/bucket` — List buckets
- `POST /publicCloud/project/{projectId}/storage/object/bucket` — Create a bucket
- `GET /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}` — Get a bucket
- `PUT /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}` — Update a bucket
- `DELETE /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}` — Delete a bucket

## List buckets

`GET /v2/publicCloud/project/{projectId}/storage/object/bucket`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/object-storage/#getBuckets

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:bucket/get`

Returns the buckets of the project.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.object.Bucket[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the bucket |
| `currentState` | publicCloud.storage.object.BucketCurrentState | read-only | Current observed state of the bucket |
| `currentState.encryption` | publicCloud.storage.object.BucketEncryptionConfig | read-only | Current encryption configuration |
| `currentState.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `currentState.location` | publicCloud.storage.object.BucketLocation | read-only | Geographic region where the bucket is located |
| `currentState.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `currentState.name` | string | read-only | Bucket name |
| `currentState.objectLock` | publicCloud.storage.object.BucketObjectLockConfig | read-only | Current object lock configuration |
| `currentState.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `currentState.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `currentState.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `currentState.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `currentState.objectsCount` | integer | read-only | Bucket total objects count. Returned only on a single bucket GET, never on LIST. |
| `currentState.objectsSize` | integer | read-only | Bucket total objects size in bytes. Returned only on a single bucket GET, never on LIST. |
| `currentState.tags` | object | read-only | Current metadata tags |
| `currentState.versioning` | publicCloud.storage.object.BucketVersioningConfig | read-only | Current versioning configuration |
| `currentState.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `currentState.virtualHost` | string | read-only | Bucket virtual host, as a hostname without scheme, for example my-data-bucket.s3.gra.io.cloud.ovh.net. Returned only on a single bucket GET, never on LIST. |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the bucket |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string | read-only | Bucket name (used as unique identifier) |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Bucket readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.object.BucketTargetSpec | read-only | Last target specification of the bucket |
| `targetSpec.encryption` | publicCloud.storage.object.BucketEncryptionConfig |  | Server-side encryption configuration |
| `targetSpec.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `targetSpec.location` | publicCloud.storage.object.BucketLocation | yes | Target geographic region |
| `targetSpec.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `targetSpec.name` | string | yes | Bucket name (must be globally unique and DNS-compatible) |
| `targetSpec.objectLock` | publicCloud.storage.object.BucketObjectLockConfig |  | Object lock (WORM) configuration. Requires versioning to be enabled. |
| `targetSpec.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `targetSpec.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `targetSpec.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `targetSpec.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `targetSpec.ownerUserId` | string |  | Container owner user ID |
| `targetSpec.tags` | object |  | Metadata tags for the bucket |
| `targetSpec.versioning` | publicCloud.storage.object.BucketVersioningConfig |  | Versioning configuration |
| `targetSpec.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `updatedAt` | string (date-time) | read-only | Last update date of the bucket |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "encryption": {
        "algorithm": "AES256"
      },
      "location": {
        "region": "string"
      },
      "name": "string",
      "objectLock": {
        "mode": "COMPLIANCE",
        "retentionDays": 0,
        "retentionYears": 0,
        "status": "DISABLED"
      },
      "objectsCount": 0,
      "objectsSize": 0,
      "tags": {
        "key": "string"
      },
      "versioning": {
        "status": "DISABLED"
      },
      "virtualHost": "string"
    },
    "currentTasks": [
      {
        "errors": [
          {
            "message": "string"
          }
        ],
        "id": "00000000-0000-0000-0000-000000000000",
        "link": "string",
        "status": "ERROR",
        "type": "string"
      }
    ],
    "id": "string",
    "resourceStatus": "CREATING",
    "targetSpec": {
      "encryption": {
        "algorithm": "AES256"
      },
      "location": {
        "region": "string"
      },
      "name": "string",
      "objectLock": {
        "mode": "COMPLIANCE",
        "retentionDays": 0,
        "retentionYears": 0,
        "status": "DISABLED"
      },
      "ownerUserId": "string",
      "tags": {
        "key": "string"
      },
      "versioning": {
        "status": "DISABLED"
      }
    },
    "updatedAt": "2024-01-01T12:00:00Z"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/storage/object/bucket")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/storage/object/bucket");

print_r($result);
?>
```

## Create a bucket

`POST /v2/publicCloud/project/{projectId}/storage/object/bucket`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/object-storage/#createBucket

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:bucket/create`

Creates a bucket in a region. Versioning, encryption, object lock and tags can be set at creation.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.storage.object.BucketCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.storage.object.BucketTargetSpec | yes | Desired target specification for the bucket to create |
| `targetSpec.encryption` | publicCloud.storage.object.BucketEncryptionConfig |  | Server-side encryption configuration |
| `targetSpec.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `targetSpec.location` | publicCloud.storage.object.BucketLocation | yes | Target geographic region |
| `targetSpec.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `targetSpec.name` | string | yes | Bucket name (must be globally unique and DNS-compatible) |
| `targetSpec.objectLock` | publicCloud.storage.object.BucketObjectLockConfig |  | Object lock (WORM) configuration. Requires versioning to be enabled. |
| `targetSpec.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `targetSpec.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `targetSpec.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `targetSpec.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `targetSpec.ownerUserId` | string |  | Container owner user ID |
| `targetSpec.tags` | object |  | Metadata tags for the bucket |
| `targetSpec.versioning` | publicCloud.storage.object.BucketVersioningConfig |  | Versioning configuration |
| `targetSpec.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |

```json
{
  "targetSpec": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "ownerUserId": "string",
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    }
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.object.Bucket | successful operation |
| 400 | object | Error 400 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the bucket |
| `currentState` | publicCloud.storage.object.BucketCurrentState | read-only | Current observed state of the bucket |
| `currentState.encryption` | publicCloud.storage.object.BucketEncryptionConfig | read-only | Current encryption configuration |
| `currentState.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `currentState.location` | publicCloud.storage.object.BucketLocation | read-only | Geographic region where the bucket is located |
| `currentState.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `currentState.name` | string | read-only | Bucket name |
| `currentState.objectLock` | publicCloud.storage.object.BucketObjectLockConfig | read-only | Current object lock configuration |
| `currentState.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `currentState.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `currentState.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `currentState.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `currentState.objectsCount` | integer | read-only | Bucket total objects count. Returned only on a single bucket GET, never on LIST. |
| `currentState.objectsSize` | integer | read-only | Bucket total objects size in bytes. Returned only on a single bucket GET, never on LIST. |
| `currentState.tags` | object | read-only | Current metadata tags |
| `currentState.versioning` | publicCloud.storage.object.BucketVersioningConfig | read-only | Current versioning configuration |
| `currentState.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `currentState.virtualHost` | string | read-only | Bucket virtual host, as a hostname without scheme, for example my-data-bucket.s3.gra.io.cloud.ovh.net. Returned only on a single bucket GET, never on LIST. |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the bucket |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string | read-only | Bucket name (used as unique identifier) |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Bucket readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.object.BucketTargetSpec | read-only | Last target specification of the bucket |
| `targetSpec.encryption` | publicCloud.storage.object.BucketEncryptionConfig |  | Server-side encryption configuration |
| `targetSpec.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `targetSpec.location` | publicCloud.storage.object.BucketLocation | yes | Target geographic region |
| `targetSpec.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `targetSpec.name` | string | yes | Bucket name (must be globally unique and DNS-compatible) |
| `targetSpec.objectLock` | publicCloud.storage.object.BucketObjectLockConfig |  | Object lock (WORM) configuration. Requires versioning to be enabled. |
| `targetSpec.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `targetSpec.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `targetSpec.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `targetSpec.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `targetSpec.ownerUserId` | string |  | Container owner user ID |
| `targetSpec.tags` | object |  | Metadata tags for the bucket |
| `targetSpec.versioning` | publicCloud.storage.object.BucketVersioningConfig |  | Versioning configuration |
| `targetSpec.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `updatedAt` | string (date-time) | read-only | Last update date of the bucket |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "objectsCount": 0,
    "objectsSize": 0,
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    },
    "virtualHost": "string"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "string",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "ownerUserId": "string",
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    }
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.storage.object.BucketCreation
result = client.post("/v2/publicCloud/project/{projectId}/storage/object/bucket",
	targetSpec = None, # Desired target specification for the bucket to create (type: publicCloud.storage.object.BucketTargetSpec)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.storage.object.BucketCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/storage/object/bucket", array(
	targetSpec => null, // Desired target specification for the bucket to create (type: publicCloud.storage.object.BucketTargetSpec)
));

print_r($result);
?>
```

## Get a bucket

`GET /v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/object-storage/#getBucket

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:bucket/get`

Returns the bucket configuration and its current state.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `bucketName` | path | string | yes | Bucket name |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.object.Bucket | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the bucket |
| `currentState` | publicCloud.storage.object.BucketCurrentState | read-only | Current observed state of the bucket |
| `currentState.encryption` | publicCloud.storage.object.BucketEncryptionConfig | read-only | Current encryption configuration |
| `currentState.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `currentState.location` | publicCloud.storage.object.BucketLocation | read-only | Geographic region where the bucket is located |
| `currentState.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `currentState.name` | string | read-only | Bucket name |
| `currentState.objectLock` | publicCloud.storage.object.BucketObjectLockConfig | read-only | Current object lock configuration |
| `currentState.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `currentState.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `currentState.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `currentState.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `currentState.objectsCount` | integer | read-only | Bucket total objects count. Returned only on a single bucket GET, never on LIST. |
| `currentState.objectsSize` | integer | read-only | Bucket total objects size in bytes. Returned only on a single bucket GET, never on LIST. |
| `currentState.tags` | object | read-only | Current metadata tags |
| `currentState.versioning` | publicCloud.storage.object.BucketVersioningConfig | read-only | Current versioning configuration |
| `currentState.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `currentState.virtualHost` | string | read-only | Bucket virtual host, as a hostname without scheme, for example my-data-bucket.s3.gra.io.cloud.ovh.net. Returned only on a single bucket GET, never on LIST. |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the bucket |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string | read-only | Bucket name (used as unique identifier) |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Bucket readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.object.BucketTargetSpec | read-only | Last target specification of the bucket |
| `targetSpec.encryption` | publicCloud.storage.object.BucketEncryptionConfig |  | Server-side encryption configuration |
| `targetSpec.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `targetSpec.location` | publicCloud.storage.object.BucketLocation | yes | Target geographic region |
| `targetSpec.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `targetSpec.name` | string | yes | Bucket name (must be globally unique and DNS-compatible) |
| `targetSpec.objectLock` | publicCloud.storage.object.BucketObjectLockConfig |  | Object lock (WORM) configuration. Requires versioning to be enabled. |
| `targetSpec.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `targetSpec.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `targetSpec.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `targetSpec.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `targetSpec.ownerUserId` | string |  | Container owner user ID |
| `targetSpec.tags` | object |  | Metadata tags for the bucket |
| `targetSpec.versioning` | publicCloud.storage.object.BucketVersioningConfig |  | Versioning configuration |
| `targetSpec.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `updatedAt` | string (date-time) | read-only | Last update date of the bucket |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "objectsCount": 0,
    "objectsSize": 0,
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    },
    "virtualHost": "string"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "string",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "ownerUserId": "string",
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    }
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}");

print_r($result);
?>
```

## Update a bucket

`PUT /v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/object-storage/#editBucket

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:bucket/edit`

Updates the bucket configuration. Send the current checksum to prevent overwriting a concurrent change. Without it, the last write wins.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `bucketName` | path | string | yes | Bucket name |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.storage.object.BucketUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string |  | Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). |
| `targetSpec` | publicCloud.storage.object.BucketUpdateTargetSpec | yes | Desired target specification for the bucket |
| `targetSpec.encryption` | publicCloud.storage.object.BucketEncryptionConfig |  | Server-side encryption configuration |
| `targetSpec.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `targetSpec.objectLock` | publicCloud.storage.object.BucketObjectLockConfig |  | Object lock (WORM) configuration. Requires versioning to be enabled. |
| `targetSpec.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `targetSpec.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `targetSpec.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `targetSpec.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `targetSpec.tags` | object |  | Metadata tags for the bucket, replacing the current ones. Omit or send an empty object to remove them all. |
| `targetSpec.versioning` | publicCloud.storage.object.BucketVersioningConfig |  | Versioning configuration |
| `targetSpec.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |

```json
{
  "checksum": "string",
  "targetSpec": {
    "encryption": {
      "algorithm": "AES256"
    },
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    }
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.object.Bucket | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the bucket |
| `currentState` | publicCloud.storage.object.BucketCurrentState | read-only | Current observed state of the bucket |
| `currentState.encryption` | publicCloud.storage.object.BucketEncryptionConfig | read-only | Current encryption configuration |
| `currentState.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `currentState.location` | publicCloud.storage.object.BucketLocation | read-only | Geographic region where the bucket is located |
| `currentState.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `currentState.name` | string | read-only | Bucket name |
| `currentState.objectLock` | publicCloud.storage.object.BucketObjectLockConfig | read-only | Current object lock configuration |
| `currentState.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `currentState.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `currentState.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `currentState.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `currentState.objectsCount` | integer | read-only | Bucket total objects count. Returned only on a single bucket GET, never on LIST. |
| `currentState.objectsSize` | integer | read-only | Bucket total objects size in bytes. Returned only on a single bucket GET, never on LIST. |
| `currentState.tags` | object | read-only | Current metadata tags |
| `currentState.versioning` | publicCloud.storage.object.BucketVersioningConfig | read-only | Current versioning configuration |
| `currentState.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `currentState.virtualHost` | string | read-only | Bucket virtual host, as a hostname without scheme, for example my-data-bucket.s3.gra.io.cloud.ovh.net. Returned only on a single bucket GET, never on LIST. |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the bucket |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string | read-only | Bucket name (used as unique identifier) |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Bucket readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.object.BucketTargetSpec | read-only | Last target specification of the bucket |
| `targetSpec.encryption` | publicCloud.storage.object.BucketEncryptionConfig |  | Server-side encryption configuration |
| `targetSpec.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `targetSpec.location` | publicCloud.storage.object.BucketLocation | yes | Target geographic region |
| `targetSpec.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `targetSpec.name` | string | yes | Bucket name (must be globally unique and DNS-compatible) |
| `targetSpec.objectLock` | publicCloud.storage.object.BucketObjectLockConfig |  | Object lock (WORM) configuration. Requires versioning to be enabled. |
| `targetSpec.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `targetSpec.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `targetSpec.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `targetSpec.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `targetSpec.ownerUserId` | string |  | Container owner user ID |
| `targetSpec.tags` | object |  | Metadata tags for the bucket |
| `targetSpec.versioning` | publicCloud.storage.object.BucketVersioningConfig |  | Versioning configuration |
| `targetSpec.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `updatedAt` | string (date-time) | read-only | Last update date of the bucket |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "objectsCount": 0,
    "objectsSize": 0,
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    },
    "virtualHost": "string"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "string",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "ownerUserId": "string",
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    }
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.storage.object.BucketUpdate
result = client.put("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}",
	checksum = None, # Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec = None, # Desired target specification for the bucket (type: publicCloud.storage.object.BucketUpdateTargetSpec)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.storage.object.BucketUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}", array(
	checksum => null, // Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec => null, // Desired target specification for the bucket (type: publicCloud.storage.object.BucketUpdateTargetSpec)
));

print_r($result);
?>
```

## Delete a bucket

`DELETE /v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/storage/object-storage/#deleteBucket

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:bucket/delete`

Deletes the bucket.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `bucketName` | path | string | yes | Bucket name |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.object.Bucket | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the bucket |
| `currentState` | publicCloud.storage.object.BucketCurrentState | read-only | Current observed state of the bucket |
| `currentState.encryption` | publicCloud.storage.object.BucketEncryptionConfig | read-only | Current encryption configuration |
| `currentState.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `currentState.location` | publicCloud.storage.object.BucketLocation | read-only | Geographic region where the bucket is located |
| `currentState.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `currentState.name` | string | read-only | Bucket name |
| `currentState.objectLock` | publicCloud.storage.object.BucketObjectLockConfig | read-only | Current object lock configuration |
| `currentState.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `currentState.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `currentState.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `currentState.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `currentState.objectsCount` | integer | read-only | Bucket total objects count. Returned only on a single bucket GET, never on LIST. |
| `currentState.objectsSize` | integer | read-only | Bucket total objects size in bytes. Returned only on a single bucket GET, never on LIST. |
| `currentState.tags` | object | read-only | Current metadata tags |
| `currentState.versioning` | publicCloud.storage.object.BucketVersioningConfig | read-only | Current versioning configuration |
| `currentState.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `currentState.virtualHost` | string | read-only | Bucket virtual host, as a hostname without scheme, for example my-data-bucket.s3.gra.io.cloud.ovh.net. Returned only on a single bucket GET, never on LIST. |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the bucket |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string | read-only | Bucket name (used as unique identifier) |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Bucket readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.storage.object.BucketTargetSpec | read-only | Last target specification of the bucket |
| `targetSpec.encryption` | publicCloud.storage.object.BucketEncryptionConfig |  | Server-side encryption configuration |
| `targetSpec.encryption.algorithm` | publicCloud.storage.object.BucketEncryptionAlgorithmEnum | yes | Encryption algorithm — one of `AES256`, `PLAINTEXT` |
| `targetSpec.location` | publicCloud.storage.object.BucketLocation | yes | Target geographic region |
| `targetSpec.location.region` | string | yes | Region identifier, for example GRA, SBG, BHS |
| `targetSpec.name` | string | yes | Bucket name (must be globally unique and DNS-compatible) |
| `targetSpec.objectLock` | publicCloud.storage.object.BucketObjectLockConfig |  | Object lock (WORM) configuration. Requires versioning to be enabled. |
| `targetSpec.objectLock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum |  | Default retention mode. Requires retentionDays or retentionYears, and status ENABLED. Null when no default retention rule is set. — one of `COMPLIANCE`, `GOVERNANCE` |
| `targetSpec.objectLock.retentionDays` | integer |  | Number of days the default retention rule locks new objects for. Requires mode, exclusive with retentionYears. Null when no default retention rule is set or when retentionYears is used. |
| `targetSpec.objectLock.retentionYears` | integer |  | Number of years the default retention rule locks new objects for. Requires mode, exclusive with retentionDays. Null when no default retention rule is set or when retentionDays is used. |
| `targetSpec.objectLock.status` | publicCloud.storage.object.BucketObjectLockStatusEnum | yes | Whether object lock is armed on the bucket, with or without a default retention rule — one of `DISABLED`, `ENABLED` |
| `targetSpec.ownerUserId` | string |  | Container owner user ID |
| `targetSpec.tags` | object |  | Metadata tags for the bucket |
| `targetSpec.versioning` | publicCloud.storage.object.BucketVersioningConfig |  | Versioning configuration |
| `targetSpec.versioning.status` | publicCloud.storage.object.BucketVersioningStatusEnum | yes | Versioning status — one of `DISABLED`, `ENABLED`, `SUSPENDED` |
| `updatedAt` | string (date-time) | read-only | Last update date of the bucket |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "objectsCount": 0,
    "objectsSize": 0,
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    },
    "virtualHost": "string"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "string",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "encryption": {
      "algorithm": "AES256"
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "objectLock": {
      "mode": "COMPLIANCE",
      "retentionDays": 0,
      "retentionYears": 0,
      "status": "DISABLED"
    },
    "ownerUserId": "string",
    "tags": {
      "key": "string"
    },
    "versioning": {
      "status": "DISABLED"
    }
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}");

print_r($result);
?>
```
