Skip to main content

Agora Console REST API

When you need to create and manage Agora projects or check usage, besides using the graphic user interface at Agora Console, you can also call the Agora Console RESTful API.

This page provides detailed help for the Agora Console RESTful APIs.

Basic information

This section provides basic information about the Agora Console RESTful APIs.

Domain

All requests are sent to the host api.agora.io. See Ensure service reliability for alternate domain names.

Data format

The Content-Type field in all HTTP request headers is application/json. All requests and responses are in JSON format. All request URLs and request bodies are case-sensitive.

Authentication

The Agora Console RESTful APIs only support HTTPS. Before sending HTTP requests, you must generate a Base64-encoded credential with the Customer ID and Customer Secret provided by Agora, and pass the credential to the Authorization field in the HTTP request header.

Call frequency limit

For each Agora account (not each App ID), the call frequency of each API on this page is no more than 10 queries per second.

Create a project

Creates an Agora project.

Prototype

  • Method: POST

  • Endpoint: https://api.agora.io/dev/v1/project

Request parameters

Request body parameters

Pass in the following parameters in the request body:

ParameterTypeDescription
nameString(Required) The project name, which is between 1 to 255 characters in length.
enable_sign_keyBoolean(Required) Whether to enable the primary app certificate:
  • true: Enable the primary app certificate.
  • false: (Default) Do not enable the primary app certificate.

Note: After creating a project, you can send a request to https://api.agora.io/dev/v1/signkey to enable or disable the primary app certificate, or send a request to https://api.agora.io/dev/v1/reset_signkey to reset the primary app certificate.

Request example

Request body


_4
{
_4
"name": "project1",
_4
"enable_sign_key": true
_4
}

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 201, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 201, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
projectObjectThe information on the project, including the following fields:
  • id: String. The project ID
  • name: String. The project name.
  • vendor_key: String. The App ID of the project.
  • sign_key: String. The primary app certificate of the project.
  • recording_server: String. The IP address of the recording server.
    • Pay attention to this field if you use v1.9.0 and earlier versions of the Agora On-Premise Recording SDK.
    • Ignore this field if you use v1.11.0 and later versions of the Agora On-Premise Recording SDK.
  • status: Number. The status of the project:
    • 1: The project is enabled.
    • 0: The project is disabled.
  • created: Number. The Unix timestamp (in seconds) of when the project is created.

Response example

The following is a response example for a successful request:


_11
{
_11
"project": {
_11
"id": "xxxx",
_11
"name": "project1",
_11
"vendor_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"sign_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"recording_server": null,
_11
"status": 1,
_11
"created": 1464165672
_11
}
_11
}

Get a specified project

Gets the information on a specified project.

Prototype

  • Method: GET

  • Endpoint: https://api.agora.io/dev/v1/project

Request Parameters

Query parameters

Pass in the following query parameters in the request URL:

ParameterTypeDescription
idString(Required) The project ID, which can be obtained by calling the Get all projects API.
nameString(Required) The project name.

Request example

Request URL

https://api.agora.io/dev/v1/project?id=7sdnf3xRH&name=project1

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 201, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 201, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
projectsArrayThe information on the projects. This Array consists of multiple Objects. Each Object shows the information on one project and includes the following fields:
  • id: String. The project ID.
  • name: String. The project name.
  • vendor_key: String. The App ID of the project.
  • sign_key: String. The primary App Certificate of the project.
  • recording_server: String. The IP of the recording server.
    • Pay attention to this field if you use v1.9.0 and earlier versions of the Agora On-Premise Recording SDK.
    • Ignore this field if you use v1.11.0 and later versions of the Agora On-Premise Recording SDK.
  • status: Number. The status of the project:
    • 1: The project is enabled.
    • 0: The project is disabled.
  • created: Number. The Unix timestamp (in seconds) of when the project is created.

Response example

The following is a response example for a successful request:


_13
{
_13
"projects": [
_13
{
_13
"id": "xxxx",
_13
"name": "project1",
_13
"sign_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_13
"vendor_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_13
"recording_server": null,
_13
"status": 1,
_13
"created": 1464165672
_13
}
_13
]
_13
}

Get all projects

Gets the information on all your Agora projects.

Prototype

  • Method: GET

  • Endpoint: https://api.agora.io/dev/v1/projects

Request example

Request URL

https://api.agora.io/dev/v1/projects

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 201, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 201, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
projectsArrayThe information on the projects. This Array consists of multiple Objects. Each Object shows the information on one project and includes the following fields:
  • id: String. The project ID.
  • name: String. The project name.
  • vendor_key: String. The App ID of the project.
  • sign_key: String. The primary App Certificate of the project.
  • recording_server: String. The IP of the recording server.
    • Pay attention to this field if you use v1.9.0 and earlier versions of the Agora On-Premise Recording SDK.
    • Ignore this field if you use v1.11.0 and later versions of the Agora On-Premise Recording SDK.
  • status: Number. The status of the project:
    • 1: The project is enabled.
    • 0: The project is disabled.
    • created: Number. The Unix timestamp (in seconds) of when the project is created.

Response example

The following is a response example for a successful request:


_22
{
_22
"projects": [
_22
{
_22
"id": "xxxx",
_22
"name": "project1",
_22
"sign_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_22
"vendor_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_22
"recording_server": null,
_22
"status": 1,
_22
"created": 1464165672
_22
},
_22
{
_22
"id": "xxxx",
_22
"name": "project1",
_22
"sign_key": "2c01da6d6f6741df88ec47005f08572b",
_22
"vendor_key": "eb00cd2b222a4eeaa24fc6046d90b227",
_22
"recording_server": null,
_22
"status": 1,
_22
"created": 1637153755
_22
}
_22
]
_22
}

Disable or enable a project

Disables or enables a specified Agora project.

Prototype

  • Method: POST

  • Endpoint: https://api.agora.io/dev/v1/project_status

Request parameters

Request body parameters

Pass in the following parameters in the request body:

ParameterTypeDescription
idString(Required) The project ID, which can be obtained by calling the Get all projects API.
statusNumber(Required) Whether to enable or disable the project:
  • 0: Disable the project.
  • 1: Enable the project.

Request example

Request body


_4
{
_4
"id": "xxxx",
_4
"status": 0
_4
}

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 201, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 201, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
projectObjectThe information on the project, including the following fields:
  • id: String. The project ID.
  • name: String. The project name.
  • vendor_key: String. The App ID of the project.
  • sign_key: String. The primary app certificate of the project.
  • recording_server: String. The IP address of the recording server.
    • Pay attention to this field if you use v1.9.0 and earlier versions of the Agora On-Premise Recording SDK.
    • Ignore this field if you use v1.11.0 and later versions of the Agora On-Premise Recording SDK.
  • status: Number. The status of the project:
    • 1: The project is enabled.
    • 0: The project is disabled.
  • created: Number. The Unix timestamp (in seconds) of when the project is created.

Response example

The following is a response example for a successful request:


_11
{
_11
"project": {
_11
"id": "xxxx",
_11
"name": "project1",
_11
"vendor_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"sign_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"recording_server": null,
_11
"status": 1,
_11
"created": 1464165672
_11
}
_11
}

Set the IP address of the recording server

Sets the IP of the recording server for a specified project.

Prototype

  • Method: POST

  • Endpoint: https://api.agora.io/dev/v1/recording_config

Request parameters

Request body parameters

Pass in the following parameters in the request body:

ParameterTypeDescription
idString(Required) The project ID, which can be obtained by calling the Get all projects API.
recording_serverString(Required) The IP address of the recording server. This field takes effect only when you use v1.9.0 or earlier versions of Agora On-Premise Recording SDK.

Request example

Request body


_4
{
_4
"id": "xxxx",
_4
"recording_server": "10.12.1.5:8080"
_4
}

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 201, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 201, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
projectObjectThe information on the project, including the following fields:
  • id: String. The project ID.
  • name: String. The project name.
  • vendor_key: String. The App ID of the project.
  • sign_key: String. The primary app certificate of the project.
  • recording_server: String. The IP address of the recording server.
    • Pay attention to this field if you use v1.9.0 and earlier versions of the Agora On-Premise Recording SDK.
    • Ignore this field if you use v1.11.0 and later versions of the Agora On-Premise Recording SDK.
  • status: Number. The status of the project:
    • 1: The project is enabled.
    • 0: The project is disabled.
  • created: Number. The Unix timestamp (in seconds) of when the project is created.

Response example

The following is a response example for a successful request:


_11
{
_11
"project": {
_11
"id": "xxxx",
_11
"name": "project1",
_11
"vendor_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"sign_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"recording_server": null,
_11
"status": 1,
_11
"created": 1464165672
_11
}
_11
}

Enable or disable the primary app certificate

Enables or disables the primary app certificate for a specified project.

Prototype

  • Method: POST

  • Endpoint: https://api.agora.io/dev/v1/signkey

Request parameters

Request body parameters

The following parameters are required in the request body:

ParameterTypeDescription
idString(Required) The project ID, which can be obtained by calling the Get all projects API.
enableBoolean a(Required) Whether to enable or disable the primary app certificate for the project:
  • true: (Default) Enable the primary app certificate.
  • false: Do not enable the primary app certificate.

Request example

Request body


_4
{
_4
"id": "xxxx",
_4
"enable": true
_4
}

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 201, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 201, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
projectObjectThe information on the project, including the following fields:
  • id: String. The project ID.
  • name: String. The project name.
  • vendor_key: String. The App ID of the project.
  • sign_key: String. The primary app certificate of the project.
  • recording_server: String. The IP address of the recording server.
    • Pay attention to this field if you use v1.9.0 and earlier versions of the Agora On-Premise Recording SDK.
    • Ignore this field if you use v1.11.0 and later versions of the Agora On-Premise Recording SDK.
  • status: Number. The status of the project:
    • 1: The project is enabled.
    • 0: The project is disabled.
  • created: Number. The Unix timestamp (in seconds) of when the project is created.

Response example

The following is a response example for a successful request:


_11
{
_11
"project": {
_11
"id": "xxxx",
_11
"name": "project1",
_11
"vendor_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"sign_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"recording_server": null,
_11
"status": 1,
_11
"created": 1464165672
_11
}
_11
}

Reset the primary app certificate

Resets the primary app certificate for a specified project.

Prototype

  • Method: POST

  • Endpoint: https://api.agora.io/dev/v1/reset_signkey

Request parameter

Request body parameter

Pass in the following parameter in the request body:

ParameterTypeDescription
idString(Required) The project ID, which can be obtained by calling the Get all projects API.

Request example

Request body


_3
{
_3
"id": "xxxx"
_3
}

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 201, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 201, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
projectObjectThe information on the project, including the following fields:
  • id: String. The project ID.
  • name: String. The project name.
  • vendor_key: String. The App ID of the project.
  • sign_key: String. The primary app certificate of the project.
  • recording_server: String. The IP address of the recording server.
    • Pay attention to this field if you use v1.9.0 and earlier versions of the Agora On-Premise Recording SDK.
    • Ignore this field if you use v1.11.0 and later versions of the Agora On-Premise Recording SDK.
  • status: Number. The status of the project:
    • 1: The project is enabled.
    • 0: The project is disabled.
  • created: Number. The Unix timestamp (in seconds) of when the project is created.

Response example

The following is a response example for a successful request:


_11
{
_11
"project": {
_11
"id": "xxxx",
_11
"name": "project1",
_11
"vendor_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"sign_key": "4855xxxxxxxxxxxxxxxxxxxxxxxxeae2",
_11
"recording_server": null,
_11
"status": 1,
_11
"created": 1464165672
_11
}
_11
}

Get project usage

Gets the usage data of a specified project.

Prototype

  • Method: GET

  • Endpoint: https://api.agora.io/dev/v3/usage

Request parameters

Query parameters

Pass the following query parameters in the request path:

ParameterTypeDescription
project_idString(Required) The project ID, which can be obtained by calling the Get all projects API.
from_dateString(Required) The start date of the query, UTC time. For example, 2020-01-01.
to_dateString(Required) The end date of the query, UTC time. For example, 2020-01-31.
businessString a(Required) The business type. You can choose one of the following values:
  • default: Audio and video. The usage on Miniapp is not included.
  • transcodeDuration: Transcoding.
  • recording: On-premise recording.
  • cloudRecording: Cloud recording.
  • miniapp: Miniapp.

Request example

Request path

https://api.agora.io/dev/v3/usage?project_id=rxxxxxxj5u&from_date=2021-10-12&to_date=2021-12-14&business=default

Response parameters

For details about possible response status codes, see the Response status codes table.

If the status code is not 200, the request fails. See the message field in the response body for the reason for this failure.

If the status code is 200, the request succeeds, and the response body includes the following parameters:

ParameterTypeDescription
metaObjectMetadata, which describes the meaning of durationAudioAll, durationVideo1080P, durationVideo2K, durationVideo4K, durationVideoHd and durationVideoHdp in the usage parameter.
  • durationAudioAll: Object. Total audio duration.
    • en: String . durationAudioAll in English, that is, "Total Audio Duration".
    • unit: String. The unit of audio duration, in seconds.
  • durationVideo1080P: Object. Total Full HD video duration.
    • en: String . durationVideo1080P in English, that is, "Full HD Video Duration (including Recording)".
    • unit: String . The unit of Full HD video duration, in seconds.
  • durationVideo2K: Object. Total duration of 2K video.
    • en: String. durationVideo2K in English, that is, "2K Video Duration(including Recording)".
    • unit: String . The unit of 2K video duration, in seconds.
  • durationVideo4K: Object. Total duration of 2K+ video.
    • en: String. durationVideo4K in English, that is, "2K+ Video Duration(including Recording)".
    • unit: String. The unit of 2K+ video duration, in seconds.
  • durationVideoHd: Total duration of HD video.
    • en: String. durationVideoHd in English, that is, "HD Video Duration (including On premise Recording)".
    • unit: String. The unit of HD video duration, in seconds.
  • durationVideoHdp: Total duration of Hdp video.
    • en: String. durationVideoHdp in English, that is, "HDP Video Duration(including Recording)".
    • unit: String. The unit of HDP video duration, in seconds.
usagesArrayUsage of the specified project. This array consists of multiple objects. Each object shows the usage of a specific day and includes the following fields:
  • date: Number. The query date, using UTC time and Unix timestamp.
  • usage: Object. The usage of the query date.
  • durationAudioAll: Number. Total duration of the audio, in seconds.
  • durationVideo1080P: Number. Total duration of Full HD video, in seconds.
  • durationVideo2K: Number. Total duration of 2K video, in seconds.
  • durationVideo4K: Number. Total duration of 2K+ video, in seconds.
  • durationVideoHd: Number. Total duration of HD video, in seconds.
  • durationVideoHdp: Number. Total duration of HDP video, in seconds.

Response example

The following is a response example for a successful request:


_63
{
_63
"meta": {
_63
"durationAudioAll": {
_63
"en": "Total Audio Duration",
_63
"unit": "second"
_63
},
_63
"durationVideo1080P": {
_63
"en": "Full HD Video Duration(including Recording)",
_63
"unit": "second"
_63
},
_63
"durationVideo2K": {
_63
"en": "2K Video Duration(including Recording)",
_63
"unit": "second"
_63
},
_63
"durationVideo4K": {
_63
"en": "4K Video Duration(including Recording)",
_63
"unit": "second"
_63
},
_63
"durationVideoHd": {
_63
"en": "HD Video Duration(including Recording)",
_63
"unit": "second"
_63
},
_63
"durationVideoHdp": {
_63
"en": "HDP Video Duration(including Recording)",
_63
"unit": "second"
_63
}
_63
},
_63
"usages": [
_63
{
_63
"date": "2021-10-12T00:00:00.000Z",
_63
"usage": {
_63
"durationAudioAll": 0,
_63
"durationVideo1080P": 0,
_63
"durationVideo2K": 0,
_63
"durationVideo4K": 0,
_63
"durationVideoHd": 0,
_63
"durationVideoHdp": 0
_63
}
_63
},
_63
{
_63
"date": "2021-10-13T00:00:00.000Z",
_63
"usage": {
_63
"durationAudioAll": 779,
_63
"durationVideo1080P": 0,
_63
"durationVideo2K": 0,
_63
"durationVideo4K": 0,
_63
"durationVideoHd": 60,
_63
"durationVideoHdp": 0
_63
}
_63
},
_63
{
_63
"date": "2021-10-14T00:00:00.000Z",
_63
"usage": {
_63
"durationAudioAll": 0,
_63
"durationVideo1080P": 0,
_63
"durationVideo2K": 0,
_63
"durationVideo4K": 0,
_63
"durationVideoHd": 0,
_63
"durationVideoHdp": 0
_63
}
_63
}
_63
]
_63
}

Response status codes

The following table shows the possible response status codes.

  • If the status code is 200 or 201, the request succeeds.

  • If the status code is neither 200 nor 201, the request fails. See the message field in the response body for the reason for this failure.

Response status codeDescription
200The request is successful.
201The request has been fulfilled, resulting in the creation of a new resource.
400Bad request. Possible reasons:
  • Duplicate project name.
  • Vendor is blocked.
  • The number of projects exceeds the maximum limit.
401Unauthorized (incorrect App ID/Customer Certificate).
403Forbidden.
404The requested resource could not be found.
415Unsupported media type. Make sure that you set Content-Typein Headers as application/json.
429Too many requests.
500Internal error of the Agora RESTful API service.

Ensure service reliability

This section presents the overall strategy you use to ensure high availability of REST services.

Switch the domain name

To ensure high availability of REST services, Agora enables you to switch domain names when you experience service outage due to regional network failures. Take the following steps to set up and switch your domain name:

  1. Set the primary domain name based on the location of your service server:

    • If the DNS address of the service server is located in a country or region other than mainland China, set the primary domain name to api.agora.io.
    • If the DNS address of the service server is in mainland China, set the primary domain name to api.sd-rtn.com.
  2. If your attempt to initiate a RESTful API request using the primary domain fails, set up your retry strategy as follows:

    1. Primary domain retry: Retry using the same primary domain name.

    2. Alternate domain retry:

      • If the current primary domain name is api.sd-rtn.com, use api.agora.io as the alternate domain name.
      • If the current primary domain name is api.agora.io, use api.sd-rtn.com as the alternate domain name.
    3. Adjacent domain retry: If alternate domain retry fails, retry using the domain name adjacent to the current region.

      For example, suppose your business server is located in Europe. You set the primary domain name to api.agora.io, and the business server resolves the primary domain name to Germany. Germany is located in central Europe (api-eu-central-1.agora.io). The domain name table shows that the adjacent area is West Europe. Use the api-eu-west-1.agora.io or api-eu-west-1.sd-rtn.com domain name to retry.

Precautions

Take the following precautions when setting up your retry strategy:

  • To avoid exceeding the QPS limit with retry requests, best practice is to use a back-off strategy. For example, wait 1 second before you retry for the first time, wait 3 seconds before retrying the second time, and wait 6 seconds before retry a third time.

  • If the request fails because of a network problem rather than a DNS domain name resolution problem, skip alternate domain retry and proceed to adjacent domain retry.

  • Before switching to the region domain name, ensure that the REST services you wish to use, for example, cloud recording or channel management, are deployed in that region.

Domain name table

The following table shows the primary and region domain names for various regions.

Primary domain nameRegion domain nameRegion
api.sd-rtn.comapi-us-west-1.sd-rtn.comWestern United States
api-us-east-1.sd-rtn.comEastern United States
api-ap-southeast-1.sd-rtn.comSoutheast Asia Pacific
api-ap-northeast-1.sd-rtn.comNortheast Asia Pacific
api-eu-west-1.sd-rtn.comWestern Europe
api-eu-central-1.sd-rtn.comCentral Europe
api-cn-east-1.sd-rtn.comEast China
api-cn-north-1.sd-rtn.comNorth China
api.agora.ioapi-us-west-1.agora.ioWestern United States
api-us-east-1.agora.ioEastern United States
api-ap-southeast-1.agora.ioSoutheast Asia Pacific
api-ap-northeast-1.agora.ioNortheast Asia Pacific
api-eu-west-1.agora.ioWestern Europe
api-eu-central-1.agora.ioCentral Europe
api-cn-east-1.agora.ioEast China
api-cn-north-1.agora.ioNorth China

Signaling