TypeScript
import { ModerationApi } from "@moderation-api/sdk";
const moderationApi = new ModerationApi({
secretKey: process.env["MODAPI_SECRET_KEY"] ?? "",
});
async function run() {
const result = await moderationApi.account.retrieve();
console.log(result);
}
run();
import os
from moderation_api import ModerationAPI
with ModerationAPI(
secret_key=os.environ["MODAPI_SECRET_KEY"],
) as moderation_api:
res = moderation_api.account.retrieve()
# Handle response
print(res)
declare(strict_types=1);
require 'vendor/autoload.php';
use ModerationApi;
$sdk = ModerationApi\ModerationApi::builder()
->setSecurity(
getenv('MODAPI_SECRET_KEY')
)
->build();
$response = $sdk->account->retrieve(
);
if ($response->object !== null) {
// handle response
}
require 'moderation_api'
Models = ::ModerationApi::Models
s = ::ModerationApi::ModerationApi.new(
secret_key: ENV.fetch('MODAPI_SECRET_KEY')
)
res = s.account.retrieve
unless res.object.nil?
# handle response
end
modapi account retrieve --secret-key "$MODAPI_SECRET_KEY"
{
"id": "<string>",
"paid_plan_name": "<string>",
"text_api_quota": 123,
"remaining_quota": 123,
"current_project": {
"id": "<string>",
"name": "<string>"
}
}{
"type": "authentication_error",
"code": "unauthorized",
"message": "Authorization not provided",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}Get account details
Get account details
TypeScript
import { ModerationApi } from "@moderation-api/sdk";
const moderationApi = new ModerationApi({
secretKey: process.env["MODAPI_SECRET_KEY"] ?? "",
});
async function run() {
const result = await moderationApi.account.retrieve();
console.log(result);
}
run();
import os
from moderation_api import ModerationAPI
with ModerationAPI(
secret_key=os.environ["MODAPI_SECRET_KEY"],
) as moderation_api:
res = moderation_api.account.retrieve()
# Handle response
print(res)
declare(strict_types=1);
require 'vendor/autoload.php';
use ModerationApi;
$sdk = ModerationApi\ModerationApi::builder()
->setSecurity(
getenv('MODAPI_SECRET_KEY')
)
->build();
$response = $sdk->account->retrieve(
);
if ($response->object !== null) {
// handle response
}
require 'moderation_api'
Models = ::ModerationApi::Models
s = ::ModerationApi::ModerationApi.new(
secret_key: ENV.fetch('MODAPI_SECRET_KEY')
)
res = s.account.retrieve
unless res.object.nil?
# handle response
end
modapi account retrieve --secret-key "$MODAPI_SECRET_KEY"
{
"id": "<string>",
"paid_plan_name": "<string>",
"text_api_quota": 123,
"remaining_quota": 123,
"current_project": {
"id": "<string>",
"name": "<string>"
}
}{
"type": "authentication_error",
"code": "unauthorized",
"message": "Authorization not provided",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}{
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"request_id": "h8fkz6kkzoa446ffve37atys",
"doc_url": "<string>",
"issues": [
{
"message": "<string>",
"path": [
"<string>"
],
"code": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.
Was this page helpful?