# citrea_syncStatus

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

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

Returns the current synchronization status of the local Citrea node for both L1 (Bitcoin) and L2 (Citrea).
The response reports either `{ Synced: <blockHeight> }` or `{ Syncing: { headBlockNumber, syncedBlockNumber } }`
for each layer.


Reference: https://www.alchemy.com/docs/chains/citrea/citrea-api-endpoints/citrea-sync-status

## Result

**Synchronization status** (object): L1 and L2 synchronization status of the node.

## Example

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "l1Status": {
      "Synced": 19224
    },
    "l2Status": {
      "Synced": 2326433
    }
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://citrea-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "citrea_syncStatus"
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'citrea_syncStatus'})
};

fetch('https://citrea-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://citrea-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "citrea_syncStatus"
}
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://citrea-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"citrea_syncStatus\"\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://citrea-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"citrea_syncStatus\"\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://citrea-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\": \"citrea_syncStatus\"\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: citrea_syncStatus
description: |
  Returns the current synchronization status of the local Citrea node for both L1 (Bitcoin) and L2 (Citrea).
  The response reports either `{ Synced: <blockHeight> }` or `{ Syncing: { headBlockNumber, syncedBlockNumber } }`
  for each layer.
params: []
result:
  name: Synchronization status
  description: L1 and L2 synchronization status of the node.
  schema:
    type: object
    required:
      - l1Status
      - l2Status
    additionalProperties: false
    properties:
      l1Status:
        description: L1 (Bitcoin) synchronization status.
        oneOf:
          - type: object
            additionalProperties: false
            required:
              - Synced
            properties:
              Synced:
                type: integer
                description: Block height when fully synced.
          - type: object
            additionalProperties: false
            required:
              - Syncing
            properties:
              Syncing:
                type: object
                required:
                  - headBlockNumber
                  - syncedBlockNumber
                additionalProperties: false
                properties:
                  headBlockNumber:
                    type: integer
                    description: Latest known block number.
                  syncedBlockNumber:
                    type: integer
                    description: Current synced block number.
      l2Status:
        description: L2 (Citrea) synchronization status.
        oneOf:
          - type: object
            additionalProperties: false
            required:
              - Synced
            properties:
              Synced:
                type: integer
                description: Block height when fully synced.
          - type: object
            additionalProperties: false
            required:
              - Syncing
            properties:
              Syncing:
                type: object
                required:
                  - headBlockNumber
                  - syncedBlockNumber
                additionalProperties: false
                properties:
                  headBlockNumber:
                    type: integer
                    description: Latest known block number.
                  syncedBlockNumber:
                    type: integer
                    description: Current synced block number.
examples:
  - name: citrea_syncStatus — fully synced
    params: []
    result:
      name: Synchronization status
      value:
        l1Status:
          Synced: 19224
        l2Status:
          Synced: 2326433
  - name: citrea_syncStatus — still syncing
    params: []
    result:
      name: Synchronization status
      value:
        l1Status:
          Synced: 19224
        l2Status:
          Syncing:
            headBlockNumber: 264052
            syncedBlockNumber: 27050
```
