> For the complete documentation index, see [llms.txt](https://docs.shyft.to/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shyft.to/callbacks/what-are-callbacks/account-callbacks.md).

# Account Callbacks

### **Overview**

In Solana, programs store their data in accounts. There might be some accounts that update quite frequently, instead of continuous polling, you can setup callbacks on them to listen to those changes in real-time.

Also, as a program owner, you need to easily query/filter your accounts data. For this, one needs to poll **getProgramAccounts()** regularly to create an off-chain replica of your accounts. This is generally very slow and not real-time, leading to discrepancies or out-of-sync data.&#x20;

With Shyft's Account Callbacks, this becomes super easy. You can register a callback on your program ID (or account addresses your are interested in) and start receiving POST requests to your backend whenever your account data changes.

### How to Create Account Callbacks

You can create callbacks programmatically through our APIs, Postman or Swagger UI.&#x20;

```javascript
const createTensorCNFTAccountCallback = async () => {
    try {
        const response = await fetch(
            "https://api.shyft.to/sol/v1/callback/create",
            {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'x-api-key': '{ YOUR-API-KEY }'
                },
                body: JSON.stringify({
                    "network": "mainnet-beta", //or devnet
                    "addresses": [
                        "TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp"
                    ],
                    "callback_url": "YOUR SERVER URL",
                    "type": "ACCOUNT", //optional, default is CALLBACK
                    "encoding": "PARSED", //optional, default is raw
                    //For parsed encoding to work, please upload IDL to Translator
                }),
            }
        );
        const data = await response.json();
        console.log(data);
    } catch (e) {
        console.error("callback creation error", e);
    }
}
createTensorCNFTAccountCallback ();
```

{% content-ref url="/pages/FeTlS8S9buZ0WVGLHkhB" %}
[Callback APIs](/callbacks/callback-apis.md)
{% endcontent-ref %}

{% embed url="<https://api.shyft.to/sol/api/explore/#/Callbacks/MonitorController_create>" %}

### Accounts Callback Payload

This is a sample account callback payload for [<mark style="color:yellow;">Tensor cNFT</mark>](https://translator.shyft.to/address/TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp) <mark style="color:yellow;">program.</mark>

You can specify **encoding** while registering a callback to receive either **raw** or **parsed** format.

{% hint style="info" %}
Upload your IDL on [<mark style="color:yellow;">Translator</mark>](https://translator.shyft.to) (Shyft's Solana Explorer) to receive parsed account Callbacks.
{% endhint %}

```json
{
    "account": "TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp",
    "accountInfo": {
        "slot": 225433098,
        "pubkey": "2BkYBWCQFjzAvozSMc8AfgKUrUA1tcoVeTbGBLWaFizV8y",
        "lamports": 6355840,
        "owner": "68CzaqYybwkrfskTsyBDg6d2HM6z1bGWk1TABiwAnMyb",
        //Program specific data
        "data": {
            "version": 1,
            "bump": [
                255
            ],
            "owner": "BcVHRoZEuEvei3nDvCVbWpL4mf7G5WnSjXuzPVrNaUF5",
            "assetId": "piccGd7zoyGuE8W147ayMwqJ5bVVRur9WP46icpPPgr",
            "amount": "016694e0",
            "currency": null,
            "expiry": "67141cb8",
            "privateTaker": null,
            "makerBroker": null,
            "raw": "TvJZiqHdsEsB/52sLXMQDxcV5ePWN7WWYX7bqSIJXlZd1IYO6ixCAkoUDDlZ3mxLiKR6T15/Uqb6/4WktYIXun6QbQ43fYc1/B/glGYBAAAAAAC4HBRnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.shyft.to/callbacks/what-are-callbacks/account-callbacks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
