WATI ASTRA OpenAPI (latest)

Download OpenAPI specification:

Introduction

WATI-AIGC-PLATFORM is the API documentation for the AIGC products within WATI.

Architecture

architecture

Features:

API-PROXY-SERVICE

An external proxy service responsible for authenticating interfaces and forwarding requests to the appropriate services. Language: GOLANG

USER-MANAGER-SERVICE

A user management service responsible for managing users, handling user login authentication, and managing user credit functionalities. Language: GOLANG

CONTENT-MANAGER-SERVICE

A content management service tasked with managing both public and user resources, including generating/deleting videos, retrieving portrait lists, and more. Language: GOLANG

MODEL-ADAPTER-SERVICE

Responsible for invoking various models to generate videos or audio. It does not expose an API; instead, it receives requests via PUBSUB. Language: PYTHON

METRICS-SERVICE

Responsible for collecting metrics and uploading them to BigQuery. It does not has a HTTP interface, only GRPC. Language: GOLANG

Common API Conventions

JSON Encoding Rules

  1. For string subtypes:
    • string(int64) for request fields: Accepts either a number or a numeric string. If the number is too large (above 2^31) and is subject to JSON Number precision limitations, it is recommended to use a string representation.
    • string(int64) for response fields: Provided as a string representing a decimal number, e.g., "1000000".
    • string(byte) for both request/response fields: Pass Base64-encoded binary data, e.g., "YWJjMTIzIT8kKiYoKSctPUB+".
    • string(date-time) for both request/response fields: Pass a date string in RFC 3339 format, e.g., "2017-01-01T10:00:20.021Z".
  2. Default values when request fields are missing:
    • For string: Defaults to an empty string "".
    • For int32/int64/float: Defaults to 0.
    • For bool: Defaults to false.
    • For object: Defaults to null.
    • For array: Defaults to an empty array.
  3. Missing fields in responses should follow the above rules.

Error Codes

  1. When an error occurs during service processing, the service returns a standardized JSON format as shown below:
    {"code": 1, "message": "verbose error message"}
    
  2. In the event of an error, the returned HTTP error code and the meaning of the code field are as follows:
Code Abbreviation HTTP Status Code Explanation
0 OK 200 Success
3 INVALID_ARGUMENT 400 Invalid parameter
5 NOT_FOUND 404 Resource not found
6 ALREADY_EXISTS 409 Resource already exists
7 PERMISSION_DENIED 403 Unauthorized access
8 RESOURCE_EXHAUSTED 429 Too many simultaneous calls by the user
9 FAILED_PRECONDITION 402 Insufficient user balance
12 UNIMPLEMENTED 501 Not implemented
13 INTERNAL 500 Internal server error
16 UNAUTHENTICATED 401 User not authenticated/authorization failed

API Authentication

Authentication is divided into API_KEY and TOKEN.

When accessing resources, the user should include the TOKEN/API_KEY in the HTTP Authorization header in the following format:

Authorization: Bearer [TOKEN/API_KEY]

AccountService

Account Service

No description

Version: 1.0.0 | Since: v1.0.0 | Doc

MappingService

Mapping Service

Mapping service for Astra Protocol

Version: 1.0.0 | Since: v1.0.0 | Doc

UsageService

Usage Service

No description

Version: 1.0.0 | Since: v1.0.0 | Doc

chat

Chat Service

Chat service for Astra Protocol

Version: 1.0.0 | Since: v1.0.0 | Doc

AccountService

AdminGetTenantSubscription

For internal

Authorizations:
BearerAuth
path Parameters
tenant_id
required
string

Responses

Response samples

Content type
application/json
{
  • "subscription": {
    }
}

AdminChangeTenantSubscription

Authorizations:
BearerAuth
path Parameters
tenant_id
required
string

now only can change free-trial end time UTC

Request Body schema: application/json
required
new_end_at
string <date-time>

Responses

Request samples

Content type
application/json
{
  • "new_end_at": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
{
  • "subscription": {
    }
}

AddonsList

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "variants": [
    ]
}

ForgotPassword

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string

Responses

Request samples

Content type
application/json
{
  • "email": "string"
}

Response samples

Content type
application/json
{
  • "token": "string"
}

ForgotPasswordReset

Authorizations:
BearerAuth
Request Body schema: application/json
required
token
string
new_password
string
password_confirm
string

Responses

Request samples

Content type
application/json
{
  • "token": "string",
  • "new_password": "string",
  • "password_confirm": "string"
}

Response samples

Content type
application/json
{ }

ForgotPasswordVerify

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string
code
string
token
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "code": "string",
  • "token": "string"
}

Response samples

Content type
application/json
{
  • "redirect_url": "string",
  • "is_valid": true,
  • "email": "string",
  • "new_token": "string"
}

UserAcceptInvite

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string (invite code)
password
string
tenant_id
string
invite_token
string
from_link
string
country
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "password": "string",
  • "tenant_id": "string",
  • "invite_token": "string",
  • "from_link": "string",
  • "country": "string"
}

Response samples

Content type
application/json
{
  • "token": "string"
}

UserCheckInvite

Authorizations:
BearerAuth
Request Body schema: application/json
required
invite_token
string

Responses

Request samples

Content type
application/json
{
  • "invite_token": "string"
}

Response samples

Content type
application/json
{
  • "invite_email": "string",
  • "tenant_id": "string"
}

Login

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string
password
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "token": "string"
}

Logout

Authorizations:
BearerAuth
Request Body schema: application/json
required
object (account_serviceLogoutRequest)

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

OAuthAuthorizeProxy

OAuth authorize callback proxy - forwards request to Dify service

Authorizations:
BearerAuth
path Parameters
provider
required
string

now only support "google, wati"

Responses

Response samples

Content type
application/json
{
  • "@type": "string",
  • "property1": null,
  • "property2": null
}

OAuthCallbackUrl

Get OAuth callback URL

Authorizations:
BearerAuth
path Parameters
provider
required
string

now only support "google, wati"

Responses

Response samples

Content type
application/json
{
  • "callback_url": "string"
}

OAuthLoginProxy

OAuth login proxy - forwards request to Dify service

Authorizations:
BearerAuth
path Parameters
provider
required
string

now only support "google, wati"

Responses

Response samples

Content type
application/json
{
  • "@type": "string",
  • "property1": null,
  • "property2": null
}

OAuthPostCallbackUrl

Get OAuth post-callback redirect URL

Authorizations:
BearerAuth
path Parameters
provider
required
string

now only support "google"

Responses

Response samples

Content type
application/json
{
  • "redirect_url": "string"
}

OAUTHLoginAndRegister

Register or Login with third-party provider

Authorizations:
BearerAuth
path Parameters
provider
required
string

now only support "google"

Responses

Response samples

Content type
application/json
{
  • "redirect_url": "string"
}

TokenRefresh

Authorizations:
BearerAuth
Request Body schema: application/json
required
token
string (old access token)

Responses

Request samples

Content type
application/json
{
  • "token": "string"
}

Response samples

Content type
application/json
{
  • "new_token": "string"
}

Register

Register

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string

Responses

Request samples

Content type
application/json
{
  • "email": "string"
}

Response samples

Content type
application/json
{
  • "redirect_url": "string",
  • "token": "string"
}

RegisterVerify

Register Verify

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string
code
string
token
string
from_link
string
country
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "code": "string",
  • "token": "string",
  • "from_link": "string",
  • "country": "string"
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "is_initialized": true
}

Session

Session API for Dify OAuth service

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string
access_token
string
refresh_token
string
from_link
string
country
string
provider
string
extra
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "access_token": "string",
  • "refresh_token": "string",
  • "from_link": "string",
  • "country": "string",
  • "provider": "string",
  • "extra": "string"
}

Response samples

Content type
application/json
{
  • "redirect_url": "string",
  • "error_code": "SC_OK",
  • "is_new_user": true
}

SubscriptionVariantList

Authorizations:
BearerAuth
query Parameters
period
string
Default: "NOT_DEFINE"
Enum: "NOT_DEFINE" "MONTHLY" "YEARLY"
plan
string
Default: "FREE"
Enum: "FREE" "PRO" "BUSINESS" "CUSTOM" "NEW_USER_TRIAL" "BYOA_USER_TRIAL"

Responses

Response samples

Content type
application/json
{
  • "variants": [
    ]
}

SubscriptionVariantGet

Authorizations:
BearerAuth
path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "variant": {
    }
}

AddonsPurchase

Authorizations:
BearerAuth
Request Body schema: application/json
required
Array of objects (account_service_innerAddonsPurchaseRequestPurchase)

Responses

Request samples

Content type
application/json
{
  • "purchases": [
    ]
}

Response samples

Content type
application/json
{
  • "redirect_url": "string"
}

TenantPortal

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "redirect_url": "string"
}

CreateSubscription

Authorizations:
BearerAuth
Request Body schema: application/json
required
id
string

Responses

Request samples

Content type
application/json
{
  • "id": "string"
}

Response samples

Content type
application/json
{
  • "redirect_url": "string"
}

UpdateSubscription

Authorizations:
BearerAuth
Request Body schema: application/json
required
new_id
string

Responses

Request samples

Content type
application/json
{
  • "new_id": "string"
}

Response samples

Content type
application/json
{
  • "redirect_url": "string"
}

GetTenantWatiUserInfo

Authorizations:
BearerAuth
path Parameters
tenant_id
required
string

Responses

Response samples

Content type
application/json
{
  • "wati_email": "string",
  • "wati_tenant": "string",
  • "wati_long_life_token": "string"
}

UserGet

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "user": {
    }
}

UserDelete

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{ }

UserUpdateAvatar

upload user avatar file with multipart/form-data

Authorizations:
BearerAuth
Request Body schema: application/json
required
object (account_serviceUserUpdateAvatarRequest)

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "thumbnail_url": "string"
}

UserInitial

Authorizations:
BearerAuth
Request Body schema: application/json
required
password
string
timezone
string

Responses

Request samples

Content type
application/json
{
  • "password": "string",
  • "timezone": "string"
}

Response samples

Content type
application/json
{
  • "token": "string"
}

UserUpdateName

Authorizations:
BearerAuth
Request Body schema: application/json
required
name
string

Responses

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
{ }

UserUpdatePassword

Authorizations:
BearerAuth
Request Body schema: application/json
required
old_password
string
new_password
string

Responses

Request samples

Content type
application/json
{
  • "old_password": "string",
  • "new_password": "string"
}

Response samples

Content type
application/json
{ }

UserTenantList

Authorizations:
BearerAuth
query Parameters
page
string <int64>

default is 1

limit
string <int64>

default is 20

Responses

Response samples

Content type
application/json
{
  • "tenants": [
    ],
  • "page": {
    }
}

UserTenantCurrentGet

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "tenant": {
    }
}

UserTenantMemberList

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "members": [
    ]
}

UserTenantMemberDelete

use post cuz we use email as a unique

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string

Responses

Request samples

Content type
application/json
{
  • "email": "string"
}

Response samples

Content type
application/json
{ }

UserTenantMemberInviteByEmail

Authorizations:
BearerAuth
Request Body schema: application/json
required
Array of objects (account_service_innerUserTenantMemberInviteByEmailRequestMember)

Responses

Request samples

Content type
application/json
{
  • "members": [
    ]
}

Response samples

Content type
application/json
{
  • "rets": [
    ]
}

UserTenantMemberUpdateRole

use post cuz we use email as a unique

Authorizations:
BearerAuth
Request Body schema: application/json
required
email
string
role
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "role": "string"
}

Response samples

Content type
application/json
{ }

UserTenantSwitch

Authorizations:
BearerAuth
Request Body schema: application/json
required
tenant_id
string

Responses

Request samples

Content type
application/json
{
  • "tenant_id": "string"
}

Response samples

Content type
application/json
{
  • "tenant_info": {
    }
}

MappingService

GetAgentList

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
{
  • "agents": [
    ]
}

CreateAgentFromTemplate

Authorizations:
BearerAuth
Request Body schema: application/json
required
template_id
string
user_id
string
tenant_id
string
name
string
description
string
update_kb
boolean
object
business_type
string
url
string
agent_type
string

Responses

Request samples

Content type
application/json
{
  • "template_id": "string",
  • "user_id": "string",
  • "tenant_id": "string",
  • "name": "string",
  • "description": "string",
  • "update_kb": true,
  • "knowledge_base_ids": {
    },
  • "business_type": "string",
  • "url": "string",
  • "agent_type": "string"
}

Response samples

Content type
application/json
{
  • "agent_id": "string",
  • "name": "string",
  • "description": "string",
  • "created_at": "string",
  • "updated_at": "string"
}

UpdateAgent

Authorizations:
BearerAuth
path Parameters
agent_id
required
string
Request Body schema: application/json
required
name
string
description
string

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "agent_id": "string",
  • "name": "string",
  • "description": "string",
  • "updated_at": "string"
}

GetAgentConfig

Authorizations:
BearerAuth
path Parameters
agent_id
required
string

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "agent_id": "string",
  • "config": {
    },
  • "created_at": "string",
  • "updated_at": "string"
}

UpdateAgentConfig

Authorizations:
BearerAuth
path Parameters
agent_id
required
string
Request Body schema: application/json
required
object (mapping_serviceConfig)
user_id
string

Responses

Request samples

Content type
application/json
{
  • "config": {
    },
  • "user_id": "string"
}

Response samples

Content type
application/json
{
  • "agent_id": "string",
  • "config": {
    },
  • "updated_at": "string"
}

GetAgentIntentions

Authorizations:
BearerAuth
path Parameters
agent_id
required
string

Responses

Response samples

Content type
application/json
{
  • "agent_id": "string",
  • "intentions": [
    ]
}

CreateAgentIntention

Authorizations:
BearerAuth
path Parameters
agent_id
required
string
Request Body schema: application/json
required
object (mapping_serviceIntention)

Responses

Request samples

Content type
application/json
{
  • "intention": {
    }
}

Response samples

Content type
application/json
{
  • "intention": {
    }
}

UpdateAgentIntention

Authorizations:
BearerAuth
path Parameters
agent_id
required
string
intention_id
required
string
Request Body schema: application/json
required
object (mapping_serviceIntention)

Responses

Request samples

Content type
application/json
{
  • "intention": {
    }
}

Response samples

Content type
application/json
{
  • "intention": {
    }
}

GetAgentLeadList

Authorizations:
BearerAuth
path Parameters
agent_id
required
string

Responses

Response samples

Content type
application/json
{
  • "leads": [
    ]
}

DeleteAgentLead

Authorizations:
BearerAuth
path Parameters
agent_id
required
string
lead_id
required
string

Responses

Response samples

Content type
application/json
{ }

UsageService

CreateSubscriptionPlan

Authorizations:
BearerAuth
Request Body schema: application/json
required
plan_name
string

If the plan is tenant-specific, the plan name is the tenant ID.

object (usage_serviceSubscriptionConfig)
description
string (subscription plan description. if not set, it is plan name)
credit_extension
integer <int32>

credit_extension (in days): The number of days that credits remain valid after the end of the subscription period.

Responses

Request samples

Content type
application/json
{
  • "plan_name": "string",
  • "config": {
    },
  • "description": "string",
  • "credit_extension": 0
}

Response samples

Content type
application/json
{
  • "plan": {
    }
}

GetSubscriptionPlan

Authorizations:
BearerAuth
path Parameters
plan_name
required
string

Responses

Response samples

Content type
application/json
{
  • "plan": {
    }
}

DeleteSubscriptionPlan

Authorizations:
BearerAuth
path Parameters
plan_name
required
string

Responses

Response samples

Content type
application/json
{ }

UpdateSubscriptionPlan

Authorizations:
BearerAuth
path Parameters
plan_name
required
string

If the plan is Free, Pro, or Business, the plan name remains the same. If the plan is tenant-specific, the plan name is the tenant ID.

Request Body schema: application/json
required
object (usage_serviceSubscriptionConfig)
description
string
credit_extension
integer <int32>

credit_extension (in days): The number of days that credits remain valid after the end of the subscription period.

Responses

Request samples

Content type
application/json
{
  • "config": {
    },
  • "description": "string",
  • "credit_extension": 0
}

Response samples

Content type
application/json
{
  • "plan": {
    }
}

ListTenantAgentsCreditUsage

Authorizations:
BearerAuth
path Parameters
tenant_id
required
string
Request Body schema: application/json
required
agent_ids
Array of strings

Responses

Request samples

Content type
application/json
{
  • "agent_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "agent_credits": {
    }
}

GetTenantAgentCreditUsage

Authorizations:
BearerAuth
path Parameters
tenant_id
required
string
agent_id
required
string

Responses

Response samples

Content type
application/json
{
  • "credits": "string"
}

GetTenantCurrentUsage

Authorizations:
BearerAuth
path Parameters
tenant_id
required
string

Responses

Response samples

Content type
application/json
{
  • "config": {
    }
}

chat

Chat

Chat with AI

Authorizations:
BearerAuth
Request Body schema: application/json
required
agent_id
string
external_user_id
string
tenant_id
string
message_content
string
response_mode
string (blocking/streaming)
conversation_id
string
object (optional key-value pairs)
source
string

Responses

Request samples

Content type
application/json
{
  • "agent_id": "string",
  • "external_user_id": "string",
  • "tenant_id": "string",
  • "message_content": "string",
  • "response_mode": "string",
  • "conversation_id": "string",
  • "inputs": {
    },
  • "source": "string"
}

Response samples

Content type
application/json
null