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
.
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:
Parameter | Type | Description |
---|---|---|
name | String | (Required) The project name, which is between 1 to 255 characters in length. |
enable_sign_key | Boolean | (Required) Whether to 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
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:
Parameter | Type | Description |
---|---|---|
project | Object | The information on the project, including the following fields:
|
Response example
The following is a response example for a successful request:
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:
Parameter | Type | Description |
---|---|---|
id | String | (Required) The project ID, which can be obtained by calling the Gets all projects API. |
name | String | (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:
Parameter | Type | Description |
---|---|---|
projects | Array | The information on the projects. This Array consists of multiple Objects. Each Object shows the information on one project and includes the following fields:
|
Response example
The following is a response example for a successful request:
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:
Parameter | Type | Description |
---|---|---|
projects | Array | The information on the projects. This Array consists of multiple Objects. Each Object shows the information on one project and includes the following fields:
|
Response example
The following is a response example for a successful request:
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:
Parameter | Type | Description |
---|---|---|
id | String | (Required) The project ID, which can be obtained by calling the Gets all projects API. |
status | Number | (Required) Whether to enable or disable the project:
|
Request example
Request body
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:
Parameter | Type | Description |
---|---|---|
project | Object | The information on the project, including the following fields:
|
Response example
The following is a response example for a successful request:
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:
Parameter | Type | Description |
---|---|---|
id | String | (Required) The project ID, which can be obtained by calling the Gets all projects API. |
recording_server | String | (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
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:
Parameter | Type | Description |
---|---|---|
project | Object | The information on the project, including the following fields:
|
Response example
The following is a response example for a successful request:
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:
Parameter | Type | Description |
---|---|---|
id | String | (Required) The project ID, which can be obtained by calling the Gets all projects API. |
enable | Boolean a | (Required) Whether to enable or disable the primary app certificate for the project:
|
Request example
Request body
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:
Parameter | Type | Description |
---|---|---|
project | Object | The information on the project, including the following fields:
|
Response example
The following is a response example for a successful request:
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:
Parameter | Type | Description |
---|---|---|
id | String | (Required) The project ID, which can be obtained by calling the Gets all projects API. |
Request example
Request body
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:
Parameter | Type | Description |
---|---|---|
project | Object | The information on the project, including the following fields:
|
Response example
The following is a response example for a successful request:
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:
Parameter | Type | Description |
---|---|---|
project_id | String | (Required) The project ID, which can be obtained by calling the Gets all projects API. |
from_date | String | (Required) The start date of the query, UTC time. For example, 2020-01-01. |
to_date | String | (Required) The end date of the query, UTC time. For example, 2020-01-31. |
business | String a | (Required) The business type. You can choose one of the following values:
|
Request example
Request path
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:
Parameter | Type | Description |
---|---|---|
meta | Object | Metadata, which describes the meaning of durationAudioAll , durationVideo1080P , durationVideo2K , durationVideo4K , durationVideoHd and durationVideoHdp in the usage parameter.
|
usages | Array | Usage of the specified project. This array consists of multiple objects. Each object shows the usage of a specific day and includes the following fields:
|
Response example
The following is a response example for a successful request:
Response status codes
The following table shows the possible response status codes.
-
If the status code is
200
or201
, the request succeeds. -
If the status code is neither
200
nor201
, the request fails. See themessage
field in the response body for the reason for this failure.
Response status code | Description |
---|---|
200 | The request is successful. |
201 | The request has been fulfilled, resulting in the creation of a new resource. |
400 | Bad request. Possible reasons:
|
401 | Unauthorized (incorrect App ID/Customer Certificate). |
403 | Forbidden. |
404 | The requested resource could not be found. |
415 | Unsupported media type. Make sure that you set Content-Type in Headers as application/json . |
429 | Too many requests. |
500 | Internal error of the Agora RESTful API service. |