# Query the IP address (/en/api-reference/api-ref/rtc/query-ip-address)

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

Retrieves Agora Notifications service server IP addresses.

- OpenAPI: /openapi/rtc/channel-management.en.yaml
- Operation ID: cma-query-ip-address
- Method: GET
- Path: /v2/ncs/ip
- Endpoint: https://api.agora.io/v2/ncs/ip

## Servers

- https://api.agora.io

Use this endpoint to retrieve the IP addresses of the Agora Notifications service server. If your server is behind a firewall, add these IP addresses to your allowlist to receive channel event notifications.


:::tip[Tip]
Agora occasionally adjusts the Agora Notifications service IP addresses. Call this endpoint at least every 24 hours and automatically update your firewall configuration with the latest addresses.
:::

## Authorization

This endpoint requires authentication.

- `basicAuth`

## Parameters

- `Content-Type` (header, optional, string) - The request content type. Use `application/json`.
  - Default: `application/json`
- `Accept` (header, optional, string) - The response content type. Use `application/json`.
  - Default: `application/json`

### Request

- The request URL and request body is case-sensitive. All requests must use HTTPS.

- `Content-Type`: `application/json`

- The request header must contain the `Authorization` field. For details, see [RESTful authentication](/en/api-reference/api-ref/rtc/authentication).


## Request body

No request body.

## Request examples

### curl

```bash
curl --request GET \
  --url https://api.sd-rtn.com/v2/ncs/ip \
  --header 'Accept: application/json' \
  --header 'Authorization: Basic <your_base64_encoded_credentials>'
```

### Node.js

```javascript
const https = require('https');

const options = {
  method: 'GET',
  hostname: 'api.sd-rtn.com',
  port: null,
  path: '/v2/ncs/ip',
  headers: {
    Authorization: 'Basic <your_base64_encoded_credentials>',
    Accept: 'application/json'
  }
};

const req = https.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
```

### Python

```python
import http.client

conn = http.client.HTTPSConnection("api.sd-rtn.com")

headers = {
    'Authorization': "Basic <your_base64_encoded_credentials>",
    'Accept': "application/json"
}

conn.request("GET", "/v2/ncs/ip", headers=headers)

res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```


### Response

- A `200` status code indicates success. The response body contains the following parameters:

- If the status code is not `200`, the request fails. See the `message` field in the response body for the reason for this failure. Refer to [Response status codes](/en/api-reference/api-ref/rtc/response-status-codes) for details.


## Responses

### 200

A `200` status code indicates success. The response body contains the result of the request.

- `data` (object)
  - `data.service` (object)
    - `data.service.hosts` (array) - A list of NCS server host objects.

A list of Agora Notifications service server host objects.
      - `data.service.hosts.items` (object)
        - `data.service.hosts.items.primaryIP` (string) - The IP address of the NCS server. Add all IP addresses returned in this field to your firewall allowlist.

The IP address of the Agora Notifications service server. Add all IP addresses returned in this field to your firewall allowlist.
### default

The request failed. See the `message` field in the response body for the reason. Refer to Response status codes for details.

No schema.

## Response examples

### 200

```json
{
  "data": {
    "service": {
      "hosts": [
        {
          "primaryIP": "xxx.xxx.xxx.xxx"
        },
        {
          "primaryIP": "xxx.xxx.xxx.xxx"
        }
      ]
    }
  }
}
```
