> For the complete documentation index, see [llms.txt](https://docs.petabox.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.petabox.io/http-api-compatible-with-amazon-s3/api-reference/getobjecttagging.md).

# GetObjectTagging

Returns the tag-set of an object. You send the GET request against the tagging subresource associated with the object

To use this operation, you must have permission to perform the `s3:GetObjectTagging` action. By default, the GET action returns information about current version of an object. For a versioned bucket, you can have multiple versions of an object in your bucket. To retrieve tags of any other version, use the versionId query parameter. You also need permission for the `s3:GetObjectVersionTagging` action.

By default, the bucket owner has this permission and can grant this permission to others.

## Request Syntax <a href="#api_getobjecttagging_requestsyntax" id="api_getobjecttagging_requestsyntax"></a>

```http
GET /{Key+}?tagging&versionId=VersionId HTTP/1.1
Host: Bucket.s3.petabox.io
x-amz-expected-bucket-owner: ExpectedBucketOwner
x-amz-request-payer: RequestPayer
```

## URI Request Parameters <a href="#api_getobjecttagging_requestparameters" id="api_getobjecttagging_requestparameters"></a>

The request uses the following URI parameters.

#### Bucket

The bucket name containing the object for which to get the tagging information.

Required: Yes

#### Key

Object key for which to get the tagging information.

Length Constraints: Minimum length of 1.

Required: Yes

#### versionId

The versionId of the object for which to get the tagging information.

#### x-amz-expected-bucket-owner

The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code `403 Forbidden` (access denied).

#### x-amz-request-payer

Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests.&#x20;

Valid Values: `requester`

## Request Body <a href="#api_getobjecttagging_requestbody" id="api_getobjecttagging_requestbody"></a>

The request does not have a request body.

## Response Syntax <a href="#api_getobjecttagging_responsesyntax" id="api_getobjecttagging_responsesyntax"></a>

```http
HTTP/1.1 200
x-amz-version-id: VersionId
<?xml version="1.0" encoding="UTF-8"?>
<Tagging>
   <TagSet>
      <Tag>
         <Key>string</Key>
         <Value>string</Value>
      </Tag>
   </TagSet>
</Tagging>
```

## Response Elements <a href="#api_getobjecttagging_responseelements" id="api_getobjecttagging_responseelements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

#### x-amz-version-id

The versionId of the object for which you got the tagging information.

The following data is returned in XML format by the service.

#### Tagging

Root level tag for the Tagging parameters.

Required: Yes.

#### TagSet

Contains the tag set.

Type: Array of Tag data types.

## Examples <a href="#api_getobjecttagging_examples" id="api_getobjecttagging_examples"></a>

#### Sample Request <a href="#api_getobjecttagging_example_1" id="api_getobjecttagging_example_1"></a>

The following request returns the tag set of the specified object.

```xml
GET /petaboxexample-object?tagging HTTP/1.1
Host: petaboxexamplebucket.s3.<Region>.petabox.io
Date: Thu, 22 Sep 2016 21:33:08 GMT
Authorization: authorization string        
```

#### Sample Response <a href="#api_getobjecttagging_example_2" id="api_getobjecttagging_example_2"></a>

This example illustrates one usage of GetObjectTagging.

```xml
HTTP/1.1 200 OK
Date: Thu, 22 Sep 2016 21:33:08 GMT
Connection: close
Server: Petabox
<?xml version="1.0" encoding="UTF-8"?>
<Tagging xmlns="http://s3.petabox.io/doc/2006-03-01/">
   <TagSet>
     <Tag>
       <Key>tag1</Key>
       <Value>val1</Value>
   </Tag>
   <Tag>
        <Key>tag2</Key>
        <Value>val2</Value>
    </Tag>
  </TagSet>
 </Tagging>       
```
