# Query streaming key (/en/api-reference/api-ref/rtmp-gateway/query-streaming-key)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Queries information for a specified Media Gateway streaming key.

- OpenAPI: /openapi/media-gateway/media-gateway.en.yaml
- Operation ID: query-media-gateway-streaming-key
- Method: GET
- Path: /{region}/v1/projects/{appId}/rtls/ingress/streamkeys/{streamkey}
- Endpoint: https://api.agora.io/{region}/v1/projects/{appId}/rtls/ingress/streamkeys/{streamkey}

## Servers

- https://api.agora.io

This method queries the current list of ongoing Media Gateway streams, including the associated UID, channel name, stream status, bitrate, and audio and video metrics.


## Authorization

This endpoint requires authentication.

- `basicAuth`
- `hmacAuth`

## Parameters

- `region` (path, required, string) - Region for the streaming key or stream. Supported values are `na` for North America, `eu` for Europe, `ap` for Asia except mainland China, and `cn` for mainland China.
  - Allowed: `na` | `eu` | `ap` | `cn`

  :::warning[Important]
  Make sure that:
  
  - The `region` value is the same as for the input source stream.
  - The domain names for setting the `region` parameter and streaming are the same.
  - The `region` value is in lowercase.
  :::
- `appId` (path, required, string) - The app ID provided by Agora to each developer. After creating a project in Agora Console, you can get an app ID. The app ID is a unique identifier for a project.
- `streamkey` (path, required, string) - The streaming key.
- `X-Request-ID` (header, optional, string) - The UUID (Universally Unique Identifier) of the request. After you pass in this field, the Agora server returns this field in the response header. It is recommended to assign `X-Request-ID` a value. If omitted, the Agora server automatically generates a UUID and returns it.
  - Example: `6d35d43f-f4c5-4b3a-9df4-8f0d7e1d5f0a`

## Request body

No request body.

## Request examples

### curl

```bash
curl --location 'https://api.agora.io/ap/v1/projects/9d2498880e934632b38b0a68fa2f1622/rtls/ingress/streamkeys/:streamkey
'
```


## Responses

### 200

The request succeeded and returned streaming key information.

- `status` (string) - Request status. `success` means the request succeeds.
- `data` (object)
  - `data.streamKey` (string) - The streaming key.
  - `data.channel` (string) - Agora channel name associated with the streaming key.
  - `data.uid` (string) - User UID associated with the streaming key.
  - `data.expiresAfter` (integer) - Validity period of the streaming key in seconds.
  - `data.createdAt` (string) - Unix timestamp, in seconds, when the streaming key was created.
### 401

The request failed. A `401 (Unauthorized)` response status code means the request is not authorized.

- `status` (string) - Request status.
- `message` (string) - Description of why the request failed.
### default

The request failed. A `401 (Unauthorized)` response status code means the request is not authorized.

- `status` (string) - Request status.
- `message` (string) - Description of why the request failed.

## Response examples

### 200

```json
{
  "status": "success",
  "data": {
    "streamKey": "2dfMTR****fys",
    "channel": "shx001",
    "uid": "1001",
    "expiresAfter": 0,
    "createdAt": "1686820170"
  }
}
```
### 401

```json
{
  "status": "error",
  "message": "Describes why the request failed."
}
```
### default

```json
{
  "status": "error",
  "message": "Describes why the request failed."
}
```
