# sui_getObject

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://sui-mainnet.g.alchemy.com/v2/{apiKey}

Fetches on-chain data for a single object using its object ID. You can control the level of detail returned by passing additional options like showing content, type, or owner.


Reference: https://www.alchemy.com/docs/chains/sui/sui-api-endpoints/sui-get-object

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| object_id | string | Yes | The ID of the queried object. |
| options | object | No | Options for specifying the content to be returned. |

## Result

**result** (object): The result containing object data or error information.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "sui_getObject",
  "params": [
    "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
    {
      "showType": true,
      "showOwner": true,
      "showPreviousTransaction": true,
      "showDisplay": false,
      "showContent": true,
      "showBcs": false,
      "showStorageRebate": true
    }
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "data": {
      "objectId": "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
      "version": "1",
      "digest": "33K5ZXJ3RyubvYaHuEnQ1QXmmbhgtrFwp199dnEbL4n7",
      "type": "0x2::coin::Coin<0x2::sui::SUI>",
      "owner": {
        "AddressOwner": "0xc8ec1d5b84dd6289e193b9f88de4a994358c9f856135236c3e75a925e1c77ac3"
      },
      "previousTransaction": "5PLgmQye6rraDYqpV3npV6H1cUXoJZgJh1dPCyRa3WCv",
      "storageRebate": "100",
      "content": {
        "dataType": "moveObject",
        "type": "0x2::coin::Coin<0x2::sui::SUI>",
        "hasPublicTransfer": true,
        "fields": {
          "balance": "100000000",
          "id": {
            "id": "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809"
          }
        }
      }
    },
    "error": null
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://sui-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_getObject",
  "params": [
    "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
    {
      "showType": true,
      "showOwner": true,
      "showPreviousTransaction": true,
      "showDisplay": false,
      "showContent": true,
      "showBcs": false,
      "showStorageRebate": true
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'sui_getObject',
    params: [
      '0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809',
      {
        showType: true,
        showOwner: true,
        showPreviousTransaction: true,
        showDisplay: false,
        showContent: true,
        showBcs: false,
        showStorageRebate: true
      }
    ]
  })
};

fetch('https://sui-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "sui_getObject",
    "params": [
        "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
        {
            "showType": True,
            "showOwner": True,
            "showPreviousTransaction": True,
            "showDisplay": False,
            "showContent": True,
            "showBcs": False,
            "showStorageRebate": True
        }
    ]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_getObject\",\n  \"params\": [\n    \"0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809\",\n    {\n      \"showType\": true,\n      \"showOwner\": true,\n      \"showPreviousTransaction\": true,\n      \"showDisplay\": false,\n      \"showContent\": true,\n      \"showBcs\": false,\n      \"showStorageRebate\": true\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://sui-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_getObject\",\n  \"params\": [\n    \"0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809\",\n    {\n      \"showType\": true,\n      \"showOwner\": true,\n      \"showPreviousTransaction\": true,\n      \"showDisplay\": false,\n      \"showContent\": true,\n      \"showBcs\": false,\n      \"showStorageRebate\": true\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://sui-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_getObject\",\n  \"params\": [\n    \"0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809\",\n    {\n      \"showType\": true,\n      \"showOwner\": true,\n      \"showPreviousTransaction\": true,\n      \"showDisplay\": false,\n      \"showContent\": true,\n      \"showBcs\": false,\n      \"showStorageRebate\": true\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: sui_getObject
summary: Return the object information for a specified object
description: |
  Fetches on-chain data for a single object using its object ID. You can control the level of detail returned by passing additional options like showing content, type, or owner.
params:
  - name: object_id
    required: true
    description: The ID of the queried object.
    schema:
      type: string
  - name: options
    required: false
    description: Options for specifying the content to be returned.
    schema:
      type: object
      properties:
        showType:
          type: boolean
        showOwner:
          type: boolean
        showPreviousTransaction:
          type: boolean
        showDisplay:
          type: boolean
        showContent:
          type: boolean
        showBcs:
          type: boolean
        showStorageRebate:
          type: boolean
result:
  name: result
  description: The result containing object data or error information.
  schema:
    type: object
    properties:
      data:
        type: object
        nullable: true
        properties:
          objectId:
            type: string
          version:
            type: string
          digest:
            type: string
          type:
            type: string
          owner:
            type: object
            properties:
              AddressOwner:
                type: string
          previousTransaction:
            type: string
          storageRebate:
            type: string
          content:
            type: object
            properties:
              dataType:
                type: string
              type:
                type: string
              hasPublicTransfer:
                type: boolean
              fields:
                type: object
                properties:
                  balance:
                    type: string
                  id:
                    type: object
                    properties:
                      id:
                        type: string
      error:
        type: object
        nullable: true
        description: Error details if the object could not be retrieved.
examples:
  - name: Get object data by ID
    params:
      - name: object_id
        value: '0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809'
      - name: options
        value:
          showType: true
          showOwner: true
          showPreviousTransaction: true
          showDisplay: false
          showContent: true
          showBcs: false
          showStorageRebate: true
    result:
      name: result
      value:
        data:
          objectId: '0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809'
          version: '1'
          digest: 33K5ZXJ3RyubvYaHuEnQ1QXmmbhgtrFwp199dnEbL4n7
          type: 0x2::coin::Coin<0x2::sui::SUI>
          owner:
            AddressOwner: '0xc8ec1d5b84dd6289e193b9f88de4a994358c9f856135236c3e75a925e1c77ac3'
          previousTransaction: 5PLgmQye6rraDYqpV3npV6H1cUXoJZgJh1dPCyRa3WCv
          storageRebate: '100'
          content:
            dataType: moveObject
            type: 0x2::coin::Coin<0x2::sui::SUI>
            hasPublicTransfer: true
            fields:
              balance: '100000000'
              id:
                id: '0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809'
        error: null
```
