# starknet_getMessagesStatus

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

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

Return statuses for L1↔L2 messages identified by message hashes and/or related transaction hashes

Reference: https://www.alchemy.com/docs/chains/starknet/starknet-api-endpoints/starknet-get-messages-status

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| filter | any | Yes | Identify messages to query |

## Result

**result** (object): Message statuses for the requested identifiers

## Code Examples

### cURL

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

### JavaScript

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

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

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "starknet_getMessagesStatus",
    "params": [None]
}
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://starknet-mainnet.g.alchemy.com/v2/docs-demo"

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

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://starknet-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\": \"starknet_getMessagesStatus\",\n  \"params\": [\n    null\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: starknet_getMessagesStatus
description: Return statuses for L1↔L2 messages identified by message hashes and/or related transaction hashes
paramStructure: by-name
params:
  - name: filter
    description: Identify messages to query
    required: true
    schema:
      title: Messages status filter
      type: object
      oneOf:
        - required:
            - message_hashes
        - required:
            - l1_transaction_hash
        - required:
            - l2_transaction_hash
      properties:
        message_hashes:
          title: Message hashes
          type: array
          items:
            title: Field element
            description: A field element. Represented by at most 63 hex digits
            type: string
            pattern: ^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$
        l1_transaction_hash:
          title: L1 transaction hash
          type: string
          description: Ethereum transaction hash that emitted one or more L1→L2 messages (0x-prefixed hex)
        l2_transaction_hash:
          title: L2 transaction hash
          description: The transaction hash, as assigned in StarkNet
          type: string
          pattern: ^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$
result:
  name: result
  description: Message statuses for the requested identifiers
  schema:
    title: MessagesStatus
    type: object
    properties:
      statuses:
        type: array
        items:
          type: object
          required:
            - message_hash
            - direction
            - status
          properties:
            message_hash:
              title: Field element
              description: A field element. Represented by at most 63 hex digits
              type: string
              pattern: ^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$
            direction:
              type: string
              enum:
                - L1_TO_L2
                - L2_TO_L1
            status:
              type: string
              description: The status of the message
              enum:
                - UNKNOWN
                - SENT
                - RECEIVED
                - REJECTED
            l1_transaction_hash:
              type: string
              description: Ethereum transaction hash if known (0x-prefixed hex)
            l2_transaction_hash:
              title: Transaction hash
              description: The transaction hash, as assigned in StarkNet
              type: string
              pattern: ^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$
```
