GetItem method
Written by
Updated at April 24, 2026
Returns a set of attributes for the item with the specified primary key.
If the item is not found, nothing is returned.
By default, the method returns eventually consistent data from the table. To get strongly consistent data, set ConsistentRead=true.
Request
The request contains data in JSON format.
{
"AttributesToGet": [ "string" ],
"ConsistentRead": boolean,
"ExpressionAttributeNames": {
"string" : "string"
},
"Key": {
"string" : {
"B": blob,
"BOOL": boolean,
"BS": [ blob ],
"L": [
"AttributeValue"
],
"M": {
"string" : "AttributeValue"
},
"N": "string",
"NS": [ "string" ],
"NULL": boolean,
"S": "string",
"SS": [ "string" ]
}
},
"ProjectionExpression": "string",
"ReturnConsumedCapacity": "string",
"TableName": "string"
}
Parameters
| Parameter | Description |
|---|---|
Key |
Associative array of attributes of the key/value type that serve as a primary key of the item to get. For a primary key, specify all its key attributes. For a simple key, you only need to specify its value. For a composite primary key, specify values for both the partition key and the sort key. Type: Object of the AttributeValue type.Length: 1 to 65,535 characters. Required: Yes |
TableName |
Name of the table with the item to get. It may contain a path in the hierarchical directory structure in path/to/table format.Type: String Length: 3 to 255 characters. Template: [a-zA-Z0-9_.-]+ Required: Yes |
ConsistentRead |
Consistency of data reads.true enables strongly consistent reads; false (by default) enables sequential reads.Type: Boolean Required: No |
ExpressionAttributeNames |
Placeholder for an attribute name in an expression. The placeholder must start with the hash character, #.You can use it in the following cases:
Percentile attribute name conflicts with the reserved word, so you cannot use it explicitly in an expression. To fix this issue, specify the {"#P":"Percentile"} placeholder in the ExpressionAttributeNames parameter, and then, further on, use #P instead of the real attribute name.Type: String Length: 1 to 65,535 characters. Required: No |
ProjectionExpression |
Expression that defines attributes to get. The attributes must be comma-separated. If you do not explicitly specify the attribute names, all item attributes will be returned. Type: String Required: No |
ReturnConsumedCapacity |
Sets whether to return information about the consumed capacity.
Type: String Possible values: TOTAL | NONERequired: No |
Response
If successful, HTTP code 200 is returned.
You will get data in JSON format.
{
"ConsumedCapacity": {
"CapacityUnits": number,
"GlobalSecondaryIndexes": {
"string" : {
"CapacityUnits": number,
"ReadCapacityUnits": number,
"WriteCapacityUnits": number
}
},
"LocalSecondaryIndexes": {
"string" : {
"CapacityUnits": number,
"ReadCapacityUnits": number,
"WriteCapacityUnits": number
}
},
"ReadCapacityUnits": number,
"Table": {
"CapacityUnits": number,
"ReadCapacityUnits": number,
"WriteCapacityUnits": number
},
"TableName": "string",
"WriteCapacityUnits": number
},
"Item": {
"string" : {
"B": blob,
"BOOL": boolean,
"BS": [ blob ],
"L": [
"AttributeValue"
],
"M": {
"string" : "AttributeValue"
},
"N": "string",
"NS": [ "string" ],
"NULL": boolean,
"S": "string",
"SS": [ "string" ]
}
}
}
Parameters
| Parameter | Description |
|---|---|
ConsumedCapacity |
Capacity units consumed by a delete operation. It is returned only if you provide ReturnConsumedCapacity set to TOTAL in the request.Type: Object of the ConsumedCapacity type. |
Item |
Attributes of the requested item. Type: Associative array of the AttributeValue type.Length: 1 to 65,535 characters. |
Errors
| Parameter | Description |
|---|---|
InternalServerError |
An internal error occurred on the server side. HTTP status code: 500 |
ProvisionedThroughputExceededException |
Your request rate is too high. Try to reduce the frequency of requests. If their number is not too large, Managed Service for YDB will try to process them all. HTTP status code: 400 |
RequestLimitExceeded |
The throughput capacity exceeds the set quota. HTTP status code: 400 |
ResourceNotFoundException |
The requested table does not exist. HTTP status code: 400 |
There may be some common errors as well shared by all methods.