# Public Cloud › Storage › Object Storage › Object Management 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

> 6 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/object-management/

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

## Operations

- `GET /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object` — List objects
- `GET /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}` — Get object metadata
- `PUT /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}` — Update object lock or legal hold
- `DELETE /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}` — Delete an object
- `POST /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/bulkDeleteObjects` — Delete several objects
- `POST /publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/presign` — Create a presigned URL

## List objects

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

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

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:storage/object/bucket/object/get`

Returns the objects of the bucket. Filter by key prefix, and group keys with a delimiter.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `bucketName` | path | string | yes | Bucket name |
| `delimiter` | query | string |  | Delimiter for grouping keys into common prefixes. Defaults to /. |
| `prefix` | query | string |  | Filter objects whose keys begin with this prefix |
| `projectId` | path | string | yes | Project ID |
| `withVersions` | query | boolean |  | Include all object versions and delete markers |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.storage.object.S3Object[] | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `etag` | string | read-only | Entity tag (hash of the object content). The etag is omitted when isDeleteMarker is true. |
| `isCommonPrefix` | boolean | read-only | Whether this entry represents a common prefix (virtual directory) |
| `isDeleteMarker` | boolean | read-only | Whether this version is a delete marker |
| `isLatest` | boolean | read-only | Whether this is the latest version of the object |
| `key` | string | read-only | Object key (path within the bucket) |
| `lastModifiedAt` | string (date-time) | read-only | Last modification timestamp. Omitted when the entry is a common prefix. |
| `legalHold` | publicCloud.storage.object.S3ObjectLegalHoldStatusEnum | read-only | Object legal hold status — one of `OFF`, `ON` |
| `lock` | publicCloud.storage.object.S3ObjectLock | read-only | Object lock retention configuration |
| `lock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum | yes | Lock retention mode — one of `COMPLIANCE`, `GOVERNANCE` |
| `lock.retainUntil` | string (date-time) | yes | Date until which the object is locked |
| `replicationStatus` | publicCloud.storage.object.S3ObjectReplicationStatusEnum | read-only | Replication status of the object — one of `COMPLETED`, `FAILED`, `NONE`, `PENDING`, `REPLICA` |
| `restoreStatus` | publicCloud.storage.object.S3ObjectRestoreStatus | read-only | Restore status for archived objects |
| `restoreStatus.expiresAt` | string (date-time) | read-only | Expiration date of the restored copy |
| `restoreStatus.inProgress` | boolean | read-only | Whether a restore operation is currently in progress |
| `size` | integer | read-only | Object size in bytes |
| `storageClass` | publicCloud.storage.object.StorageClassEnum | read-only | Storage class of the object. Omitted when the entry is a delete marker or a common prefix. — one of `DEEP_ARCHIVE`, `GLACIER_IR`, `HIGH_PERF`, `STANDARD`, `STANDARD_IA` |
| `versionId` | string | read-only | Identifier of the version |

```json
[
  {
    "etag": "string",
    "isCommonPrefix": true,
    "isDeleteMarker": true,
    "isLatest": true,
    "key": "string",
    "lastModifiedAt": "2024-01-01T12:00:00Z",
    "legalHold": "OFF",
    "lock": {
      "mode": "COMPLIANCE",
      "retainUntil": "2024-01-01T12:00:00Z"
    },
    "replicationStatus": "COMPLETED",
    "restoreStatus": {
      "expiresAt": "2024-01-01T12:00:00Z",
      "inProgress": true
    },
    "size": 0,
    "storageClass": "DEEP_ARCHIVE",
    "versionId": "string"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object" \
  -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}/object")

# 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}/object");

print_r($result);
?>
```

## Get object metadata

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

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

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:storage/object/bucket/object/get`

Returns the object metadata, without its content.

### Parameters

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

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `etag` | string | read-only | Entity tag (hash of the object content). The etag is omitted when isDeleteMarker is true. |
| `isCommonPrefix` | boolean | read-only | Whether this entry represents a common prefix (virtual directory) |
| `isDeleteMarker` | boolean | read-only | Whether this version is a delete marker |
| `isLatest` | boolean | read-only | Whether this is the latest version of the object |
| `key` | string | read-only | Object key (path within the bucket) |
| `lastModifiedAt` | string (date-time) | read-only | Last modification timestamp. Omitted when the entry is a common prefix. |
| `legalHold` | publicCloud.storage.object.S3ObjectLegalHoldStatusEnum | read-only | Object legal hold status — one of `OFF`, `ON` |
| `lock` | publicCloud.storage.object.S3ObjectLock | read-only | Object lock retention configuration |
| `lock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum | yes | Lock retention mode — one of `COMPLIANCE`, `GOVERNANCE` |
| `lock.retainUntil` | string (date-time) | yes | Date until which the object is locked |
| `replicationStatus` | publicCloud.storage.object.S3ObjectReplicationStatusEnum | read-only | Replication status of the object — one of `COMPLETED`, `FAILED`, `NONE`, `PENDING`, `REPLICA` |
| `restoreStatus` | publicCloud.storage.object.S3ObjectRestoreStatus | read-only | Restore status for archived objects |
| `restoreStatus.expiresAt` | string (date-time) | read-only | Expiration date of the restored copy |
| `restoreStatus.inProgress` | boolean | read-only | Whether a restore operation is currently in progress |
| `size` | integer | read-only | Object size in bytes |
| `storageClass` | publicCloud.storage.object.StorageClassEnum | read-only | Storage class of the object. Omitted when the entry is a delete marker or a common prefix. — one of `DEEP_ARCHIVE`, `GLACIER_IR`, `HIGH_PERF`, `STANDARD`, `STANDARD_IA` |
| `versionId` | string | read-only | Identifier of the version |

```json
{
  "etag": "string",
  "isCommonPrefix": true,
  "isDeleteMarker": true,
  "isLatest": true,
  "key": "string",
  "lastModifiedAt": "2024-01-01T12:00:00Z",
  "legalHold": "OFF",
  "lock": {
    "mode": "COMPLIANCE",
    "retainUntil": "2024-01-01T12:00:00Z"
  },
  "replicationStatus": "COMPLETED",
  "restoreStatus": {
    "expiresAt": "2024-01-01T12:00:00Z",
    "inProgress": true
  },
  "size": 0,
  "storageClass": "DEEP_ARCHIVE",
  "versionId": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}" \
  -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}/object/{key}")

# 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}/object/{key}");

print_r($result);
?>
```

## Update object lock or legal hold

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

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

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:storage/object/bucket/object/edit`

Sets the retention period or the legal hold of the object. A locked object cannot be deleted or overwritten.

### Parameters

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

### Request body (required)

Type: `publicCloud.storage.object.S3ObjectUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `legalHold` | publicCloud.storage.object.S3ObjectLegalHoldStatusEnum |  | Object legal hold status — one of `OFF`, `ON` |
| `lock` | publicCloud.storage.object.S3ObjectLock |  | Object lock retention configuration |
| `lock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum | yes | Lock retention mode — one of `COMPLIANCE`, `GOVERNANCE` |
| `lock.retainUntil` | string (date-time) | yes | Date until which the object is locked |

```json
{
  "legalHold": "OFF",
  "lock": {
    "mode": "COMPLIANCE",
    "retainUntil": "2024-01-01T12:00:00Z"
  }
}
```

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `etag` | string | read-only | Entity tag (hash of the object content). The etag is omitted when isDeleteMarker is true. |
| `isCommonPrefix` | boolean | read-only | Whether this entry represents a common prefix (virtual directory) |
| `isDeleteMarker` | boolean | read-only | Whether this version is a delete marker |
| `isLatest` | boolean | read-only | Whether this is the latest version of the object |
| `key` | string | read-only | Object key (path within the bucket) |
| `lastModifiedAt` | string (date-time) | read-only | Last modification timestamp. Omitted when the entry is a common prefix. |
| `legalHold` | publicCloud.storage.object.S3ObjectLegalHoldStatusEnum | read-only | Object legal hold status — one of `OFF`, `ON` |
| `lock` | publicCloud.storage.object.S3ObjectLock | read-only | Object lock retention configuration |
| `lock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum | yes | Lock retention mode — one of `COMPLIANCE`, `GOVERNANCE` |
| `lock.retainUntil` | string (date-time) | yes | Date until which the object is locked |
| `replicationStatus` | publicCloud.storage.object.S3ObjectReplicationStatusEnum | read-only | Replication status of the object — one of `COMPLETED`, `FAILED`, `NONE`, `PENDING`, `REPLICA` |
| `restoreStatus` | publicCloud.storage.object.S3ObjectRestoreStatus | read-only | Restore status for archived objects |
| `restoreStatus.expiresAt` | string (date-time) | read-only | Expiration date of the restored copy |
| `restoreStatus.inProgress` | boolean | read-only | Whether a restore operation is currently in progress |
| `size` | integer | read-only | Object size in bytes |
| `storageClass` | publicCloud.storage.object.StorageClassEnum | read-only | Storage class of the object. Omitted when the entry is a delete marker or a common prefix. — one of `DEEP_ARCHIVE`, `GLACIER_IR`, `HIGH_PERF`, `STANDARD`, `STANDARD_IA` |
| `versionId` | string | read-only | Identifier of the version |

```json
{
  "etag": "string",
  "isCommonPrefix": true,
  "isDeleteMarker": true,
  "isLatest": true,
  "key": "string",
  "lastModifiedAt": "2024-01-01T12:00:00Z",
  "legalHold": "OFF",
  "lock": {
    "mode": "COMPLIANCE",
    "retainUntil": "2024-01-01T12:00:00Z"
  },
  "replicationStatus": "COMPLETED",
  "restoreStatus": {
    "expiresAt": "2024-01-01T12:00:00Z",
    "inProgress": true
  },
  "size": 0,
  "storageClass": "DEEP_ARCHIVE",
  "versionId": "string"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}" \
  -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.S3ObjectUpdate
result = client.put("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}",
	legalHold = None, # Object legal hold status (type: publicCloud.storage.object.S3ObjectLegalHoldStatusEnum, nullable)
	lock = None, # Object lock retention configuration (type: publicCloud.storage.object.S3ObjectLock, nullable)
)

# 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.S3ObjectUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}", array(
	legalHold => null, // Object legal hold status (type: publicCloud.storage.object.S3ObjectLegalHoldStatusEnum, nullable)
	lock => null, // Object lock retention configuration (type: publicCloud.storage.object.S3ObjectLock, nullable)
));

print_r($result);
?>
```

## Delete an object

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

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

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:storage/object/bucket/object/delete`

Deletes the object. On a versioned bucket, adds a delete marker instead of removing the object.

### Parameters

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

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `etag` | string | read-only | Entity tag (hash of the object content). The etag is omitted when isDeleteMarker is true. |
| `isCommonPrefix` | boolean | read-only | Whether this entry represents a common prefix (virtual directory) |
| `isDeleteMarker` | boolean | read-only | Whether this version is a delete marker |
| `isLatest` | boolean | read-only | Whether this is the latest version of the object |
| `key` | string | read-only | Object key (path within the bucket) |
| `lastModifiedAt` | string (date-time) | read-only | Last modification timestamp. Omitted when the entry is a common prefix. |
| `legalHold` | publicCloud.storage.object.S3ObjectLegalHoldStatusEnum | read-only | Object legal hold status — one of `OFF`, `ON` |
| `lock` | publicCloud.storage.object.S3ObjectLock | read-only | Object lock retention configuration |
| `lock.mode` | publicCloud.storage.object.BucketObjectLockModeEnum | yes | Lock retention mode — one of `COMPLIANCE`, `GOVERNANCE` |
| `lock.retainUntil` | string (date-time) | yes | Date until which the object is locked |
| `replicationStatus` | publicCloud.storage.object.S3ObjectReplicationStatusEnum | read-only | Replication status of the object — one of `COMPLETED`, `FAILED`, `NONE`, `PENDING`, `REPLICA` |
| `restoreStatus` | publicCloud.storage.object.S3ObjectRestoreStatus | read-only | Restore status for archived objects |
| `restoreStatus.expiresAt` | string (date-time) | read-only | Expiration date of the restored copy |
| `restoreStatus.inProgress` | boolean | read-only | Whether a restore operation is currently in progress |
| `size` | integer | read-only | Object size in bytes |
| `storageClass` | publicCloud.storage.object.StorageClassEnum | read-only | Storage class of the object. Omitted when the entry is a delete marker or a common prefix. — one of `DEEP_ARCHIVE`, `GLACIER_IR`, `HIGH_PERF`, `STANDARD`, `STANDARD_IA` |
| `versionId` | string | read-only | Identifier of the version |

```json
{
  "etag": "string",
  "isCommonPrefix": true,
  "isDeleteMarker": true,
  "isLatest": true,
  "key": "string",
  "lastModifiedAt": "2024-01-01T12:00:00Z",
  "legalHold": "OFF",
  "lock": {
    "mode": "COMPLIANCE",
    "retainUntil": "2024-01-01T12:00:00Z"
  },
  "replicationStatus": "COMPLETED",
  "restoreStatus": {
    "expiresAt": "2024-01-01T12:00:00Z",
    "inProgress": true
  },
  "size": 0,
  "storageClass": "DEEP_ARCHIVE",
  "versionId": "string"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/object/{key}" \
  -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}/object/{key}")

# 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}/object/{key}");

print_r($result);
?>
```

## Delete several objects

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

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

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:storage/object/bucket/bulkDeleteObjects`

Deletes a list of objects in one request. To delete a large number of objects, use lifecycle rules instead.

### 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.S3BulkDeleteBody`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `objects` | publicCloud.storage.object.S3BulkDeleteObjectIdentifier[] | yes | Objects to delete |
| `objects[].key` | string | yes | Object key |
| `objects[].versionId` | string |  | Identifier of the version |

```json
{
  "objects": [
    {
      "key": "string",
      "versionId": "string"
    }
  ]
}
```

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `deleted` | publicCloud.storage.object.S3BulkDeletedObject[] | read-only | Successfully deleted objects |
| `deleted[].deleteMarkerVersionId` | string | read-only | Version identifier of the delete marker created by the deletion |
| `deleted[].key` | string | read-only | Object key |
| `deleted[].versionId` | string | read-only | Identifier of the version |
| `deleted[].wasADeleteMarker` | boolean | read-only | Whether the deleted object was a delete marker |
| `errors` | publicCloud.storage.object.S3BulkDeleteError[] | read-only | Failed deletions |
| `errors[].code` | string | read-only | Error code from S3 |
| `errors[].key` | string | read-only | Object key |
| `errors[].message` | string | read-only | Error message |
| `errors[].versionId` | string | read-only | Identifier of the version |

```json
{
  "deleted": [
    {
      "deleteMarkerVersionId": "string",
      "key": "string",
      "versionId": "string",
      "wasADeleteMarker": true
    }
  ],
  "errors": [
    {
      "code": "string",
      "key": "string",
      "message": "string",
      "versionId": "string"
    }
  ]
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/bulkDeleteObjects" \
  -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.S3BulkDeleteBody
result = client.post("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/bulkDeleteObjects",
	objects = None, # Objects to delete (type: array)
)

# 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.S3BulkDeleteBody
$result = $ovh->post("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/bulkDeleteObjects", array(
	objects => null, // Objects to delete (type: array)
));

print_r($result);
?>
```

## Create a presigned URL

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

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

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:storage/object/bucket/presign/create`

Creates a temporary URL to download or upload an object without credentials. The URL expires after the given time.

### 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.S3ObjectPresignedURLCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expiresIn` | integer |  | URL expiration time in seconds. When omitted, one hour (3600). |
| `key` | string | yes | Object key of new object or existing object to access |
| `method` | publicCloud.storage.object.PresignedURLMethodEnum | yes | HTTP method for the presigned URL — one of `DELETE`, `GET`, `PUT` |
| `storageClass` | publicCloud.storage.object.StorageClassEnum |  | Storage class for PUT uploads — one of `DEEP_ARCHIVE`, `GLACIER_IR`, `HIGH_PERF`, `STANDARD`, `STANDARD_IA` |
| `versionId` | string |  | Identifier of the object version |

```json
{
  "expiresIn": 0,
  "key": "string",
  "method": "DELETE",
  "storageClass": "DEEP_ARCHIVE",
  "versionId": "string"
}
```

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expiresAt` | string (date-time) | read-only | URL expiration timestamp |
| `key` | string | read-only | Object key |
| `method` | publicCloud.storage.object.PresignedURLMethodEnum | read-only | Presigned URL method — one of `DELETE`, `GET`, `PUT` |
| `signedHeaders` | object | read-only | Headers you must send with the request, exactly as returned here. The signature covers them, so changing or omitting one makes the request be refused. |
| `url` | string | read-only | Presigned URL for object access |
| `versionId` | string | read-only | Identifier of the version |

```json
{
  "expiresAt": "2024-01-01T12:00:00Z",
  "key": "string",
  "method": "DELETE",
  "signedHeaders": {
    "key": "string"
  },
  "url": "string",
  "versionId": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/presign" \
  -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.S3ObjectPresignedURLCreation
result = client.post("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/presign",
	expiresIn = None, # URL expiration time in seconds. When omitted, one hour (3600). (type: integer, nullable)
	key = None, # Object key of new object or existing object to access (type: string)
	method = None, # HTTP method for the presigned URL (type: publicCloud.storage.object.PresignedURLMethodEnum)
	storageClass = None, # Storage class for PUT uploads (type: publicCloud.storage.object.StorageClassEnum, nullable)
	versionId = None, # Identifier of the object version (type: string, nullable)
)

# 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.S3ObjectPresignedURLCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/storage/object/bucket/{bucketName}/presign", array(
	expiresIn => null, // URL expiration time in seconds. When omitted, one hour (3600). (type: integer, nullable)
	key => null, // Object key of new object or existing object to access (type: string)
	method => null, // HTTP method for the presigned URL (type: publicCloud.storage.object.PresignedURLMethodEnum)
	storageClass => null, // Storage class for PUT uploads (type: publicCloud.storage.object.StorageClassEnum, nullable)
	versionId => null, // Identifier of the object version (type: string, nullable)
));

print_r($result);
?>
```
