> For the complete documentation index, see [llms.txt](https://docs.cicleo.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cicleo.io/developer-integration/usage-off-chain.md).

# Usage Off Chain

<figure><img src="/files/gdulIwPr8BMQZYvfVlHQ" alt=""><figcaption></figcaption></figure>

To integrate Cicleo with your project's off-chain database, you need to set up a URL that Cicleo will call every time a user changes their subscription status.

**Request Type: POST**

### Request Body Example:

<pre class="language-javascript"><code class="lang-javascript"><strong>{
</strong><strong>    address : "0X95CF5354519A6AD2BD7E53FE7763201DFB24BFE4"//Always in Uppercase
</strong><strong>    subscriptionId: 1,
</strong><strong>    secret: "LFHIOENDOUDGHIDG",
</strong><strong>    endTime: 1679484296 //Still in second timestamp
</strong><strong>}
</strong></code></pre>

To fully integrate Cicleo with your project's off-chain database, you need to create an API endpoint that Cicleo can call using a secure key. This ensures maximum security when connecting Cicleo's off-chain capabilities with your project's database.

### Example of backend

```javascript
const express = require("express");
const CICLEO_SECRET = ""//To replace with your secret 

const app = express();

//Create a mydomain.com/subscription/set link that i will use for cicleo
app.post("/subscription/set", (async (req, res, next) => {
    //Verify if caller is cicleo
    if (req.body.secret != CICLEO_SECRET) {
        res.status(401).json({ message: "Wrong secret" });
        return;
    }
        
    //Address of the user subscribed
    const address = req.body.address;
    //The subscriptionid of the user
    const subscriptionId = req.body.subscriptionId;
    //And the unix timestamp (second) of the ending of his subscription
    const endTime = req.body.endTime;
    
    
    //Then do your thing to save it !
);

```


---

# 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:

```
GET https://docs.cicleo.io/developer-integration/usage-off-chain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
