> For the complete documentation index, see [llms.txt](https://aerocode.gitbook.io/tynamo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aerocode.gitbook.io/tynamo/tynamo-1/create-tynamo/tynamotable/getitem.md).

# getItem

### Spec

```typescript
async getItem<TSource>(
    tnmInput: TynamoGetItemInput<TSource>
): Promise<TynamoGetItemOutput<TSource>>;
```

### Input&#x20;

```typescript
export interface TynamoGetItemInput<TSource> {
    Key: TSource;
    
    // Derived from DynamoDB.
    ConsistentRead?: ConsistentRead;
    ReturnConsumedCapacity?: ReturnConsumedCapacity;
    ProjectionExpression?: ProjectionExpression;
    ExpressionAttributeNames?: ExpressionAttributeNameMap;
}
```

| Name | Type            | Info             |
| ---- | --------------- | ---------------- |
| Key  | `@DynamoEntity` | The key of item. |

{% hint style="info" %}
Unlisted param is derived from `DynamoDB`.

Check [here](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html) for more information.
{% endhint %}

### Output

```typescript
export interface TynamoGetItemOutput<TSource> {
    Item?: TSource;
    
    // Derived from DynamoDB.
    ConsumedCapacity?: ConsumedCapacity;
}
```

| Name | Type            | Info                           |
| ---- | --------------- | ------------------------------ |
| Item | `@DynamoEntity` | Result of `getItem` operation. |

{% hint style="info" %}
Unlisted param is derived from `GetItemOutput`.

Check [here](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html) for more information.
{% endhint %}

### Example

```typescript
@DynamoEntity()
class Cat {
    @DynamoProperty({ keyType: KeyType.hash })
    id!: number;

    @DynamoProperty({ keyType: KeyType.attr })
    name!: string;

    constructor(id: number, name: string) {
        this.id = id;
        this.name = name;
    }
}

const tynamo: Tynamo = new Tynamo({
    region: "ap-northeast-2",
    endpoint: "http://localhost:8000"
});
const tynamoTable = tynamo.getTableOf(Cat);


await tynamoTable.getItem({
    Key: new Cat(666, ""),
    ProjectionExpression: "#name"
});
```
