

# DeleteAttributes
<a name="SDB_API_DeleteAttributes"></a>

## Description
<a name="SDB_API_DeleteAttributes_Description"></a>

Deletes one or more attributes associated with the item. If all attributes of an item are deleted, the item is deleted.

**Note**  
If you specify `DeleteAttributes` without attributes or values, all the attributes for the item are deleted.   
Unless you specify conditions, the `DeleteAttributes` is an idempotent operation; running it multiple times on the same item or attribute does *not* result in an error response.  
Conditional deletes are useful for only deleting items and attributes if specific conditions are met. If the conditions are met, Amazon SimpleDB performs the delete. Otherwise, the data is not deleted.   
When using eventually consistent reads, a [GetAttributes](SDB_API_GetAttributes.md) or [Select](SDB_API_Select.md) request (read) immediately after a [DeleteAttributes](#SDB_API_DeleteAttributes) or [PutAttributes](SDB_API_PutAttributes.md) request (write) might not return the updated data. A consistent read always reflects all writes that received a successful response prior to the read. For more information, see [Consistency](ConsistencySummary.md).  
You can perform the expected conditional check on one attribute per operation.

## Request Parameters
<a name="SDB_API_DeleteAttributes_RequestParameters"></a>


|  Name  |  Description  |  Required | 
| --- | --- | --- | 
|  ItemName  |  The name of the item. Type: String  |  Yes  | 
|  `Attribute.X.Name`  |  The name of the attribute. X can be any positive integer or 0. If you specify `DeleteAttributes` without attribute names or values, all the attributes for the item are deleted. Type: String  |  No  | 
|  `Attribute.X.Value`  |  The name of the attribute value (for multi-valued attributes). X can be any positive integer or 0. If an attribute value is specified, then the corresponding attribute name is required. Type: String  |  No  | 
|  DomainName  |  The name of the domain in which to perform the operation.  Type: String   |  Yes  | 
|  `Expected.Name`  |  Name of the attribute to check.  Type: String.  Conditions: Must be used with the expected value or expected exists parameter.   When used with the expected value parameter, you specify the value to check.   When expected exists is set to `true` and it is used with the expected value parameter, it performs similarly to just using the expected value parameter. When expected exists is set to `false`, the operation is performed if the expected attribute is not present.   Can only be used with single-valued attributes.   | Conditional | 
|  `Expected.Value`  |  Value of the attribute to check. Type: String.  Conditions: Must be used with the expected name parameter. Can be used with the expected exists parameter if that parameter is set to `true`.   Can only be used with single-valued attributes.  | Conditional | 
|  `Expected.Exists`  |  Flag to test the existence of an attribute while performing conditional updates. Type: Boolean.  Conditions: Must be used with the expected name parameter. When set to `true`, this must be used with the expected value parameter. When set to `false`, this cannot be used with the expected value parameter.   Can only be used with single-valued attributes.  | Conditional | 

## Response Elements
<a name="SDB_API_DeleteAttributes_CommonResponseElements"></a>

See [Common Response Elements](SDB_API_CommonResponseElements.md).

## Special Errors
<a name="SDB_API_DeleteAttributes_SpecialErrors"></a>


|  Error  |  Description  | 
| --- | --- | 
|  AttributeDoesNotExist  |  Attribute ("\$1 name \$1 ") does not exist. | 
|  ConditionalCheckFailed  |  Conditional check failed. Attribute (" \$1 name \$1 ") value exists.  | 
|  ConditionalCheckFailed  |  Conditional check failed. Attribute ("\$1 name \$1") value is ("\$1 value \$1") but was expected ("\$1 expValue \$1"). | 
|  ExistsAndExpectedValue  |  Expected.Exists=false and Expected.Value cannot be specified together. | 
|  IncompleteExpectedExpression  |  If Expected.Exists=true or unspecified, then Expected.Value has to be specified. | 
|  InvalidParameterValue  |  Value (" \$1 value \$1 ") for parameter Expected.Exists is invalid. Expected.Exists should be either true or false.  | 
|  InvalidParameterValue  |  Value (" \$1 value \$1 ") for parameter Name is invalid.The empty string is an illegal attribute name. | 
|  InvalidParameterValue  |  Value (" \$1 value \$1 ") for parameter Name is invalid. Value exceeds maximum length of 1024. | 
|  InvalidParameterValue  |  Value (" \$1 value \$1 ") for parameter Value is invalid. Value exceeds maximum length of 1024. | 
|  InvalidParameterValue  |  Value (" \$1 value \$1 ") for parameter Item is invalid. Value exceeds max length of 1024. | 
|  InvalidWSDLVersion  |  Parameter (" \$1 parameterName \$1") is only supported in WSDL version 2009-04-15 or beyond. Please upgrade to new version. | 
|  MissingParameter  |  The request must contain the parameter DomainName. | 
|  MissingParameter  |  The request must contain the parameter ItemName. | 
|  MissingParameter  |  The request must contain the attribute Name, if an attribute Value is specified.  | 
|  MultipleExistsConditions  |  Only one Exists condition can be specified. | 
|  MultipleExpectedNames  |  Only one Expected.Name can be specified. | 
|  MultipleExpectedValues  |  Only one Expected.Value can be specified. | 
|  MultiValuedAttribute  |  Attribute (" \$1 name \$1 ") is multi-valued. Conditional check can only be performed on a single-valued attribute. | 
|  NoSuchDomain  |  The specified domain does not exist. | 

## Examples
<a name="SDB_API_DeleteAttributes_Examples"></a>

### Sample Request
<a name="SDB_API_DeleteAttributes_Examples_Request"></a>

In this example, the Jumbo Fez has sold out in several colors. The following deletes the `red`, `brick`, and `garnet` values from the `color` attribute of the `JumboFez` item.

```
https://sdb.amazonaws.com/
?Action=DeleteAttributes
&Attribute.1.Name=color
&Attribute.1.Value=red
&Attribute.2.Name=color
&Attribute.2.Value=brick
&Attribute.3.Name=color
&Attribute.3.Value=garnet
&AWSAccessKeyId=[valid access key id]
&DomainName=MyDomain
&ItemName=JumboFez
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2010-01-25T15%3A03%3A07-07%3A00
&Version=2009-04-15
&Signature=[valid signature]
```

### Sample Response
<a name="SDB_API_DeleteAttributes_Examples_Response"></a>

```
<DeleteAttributesResponse">
  <ResponseMetadata>
    <RequestId>05ae667c-cfac-41a8-ab37-a9c897c4c3ca</RequestId>
    <BoxUsage>0.0000219907</BoxUsage>
  </ResponseMetadata>
</DeleteAttributesResponse>
```

### Sample Request
<a name="SDB_API_DeleteAttributes_Examples_Request2"></a>

In this example, the Micro Fez has sold out. The following deletes the Micro Fez if the quantity reaches 0

**Note**  
For more examples of conditional operations, see [Conditionally Putting and Deleting Data](ConditionalPutDelete.md).

```
https://sdb.amazonaws.com/
?Action=DeleteAttributes
&ItemName=MicroFez
&Expected.Name=quantity
&Expected.Value=0
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2010-01-25T15%3A03%3A07-07%3A00
&Version=2009-04-15
&Signature=[valid signature]
```

### Sample Response
<a name="SDB_API_DeleteAttributes_Examples_Response2"></a>

```
<DeleteAttributesResponse>
  <ResponseMetadata>
    <RequestId>05ae667c-cfac-41a8-ab37-a9c897c4c3ca</RequestId>
    <BoxUsage>0.0000219907</BoxUsage>
  </ResponseMetadata>
</DeleteAttributesResponse>
```

## Related Actions
<a name="SDB_API_DeleteAttributes_Related_Actions"></a>
+  [BatchDeleteAttributes](SDB_API_BatchDeleteAttributes.md) 
+  [GetAttributes](SDB_API_GetAttributes.md) 
+  [PutAttributes](SDB_API_PutAttributes.md) 