API reference
Authentication
Sign-in for Ky Admin and the customer panel, sessions, two-factor authentication.
Turn off the account's two-factor authentication (admin)
DELETE/api/v1/accounts/{id}/2fa
An admin turns a customer's 2FA off (lost phone and recovery codes).
Parameters
| Name | In |
|---|---|
id | path |
Responses
- 204 Done, no content
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 404 Not Found: not-found
- 500 Internal Server Error: internal
Two-factor authentication status
GET/api/v1/accounts/{id}/2fa
Parameters
| Name | In |
|---|---|
id | path |
Responses
- 200 OK
Body
Field Type enabledboolean enabled_atinteger recovery_codes_leftinteger - 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 500 Internal Server Error: internal
Turn off two-factor authentication
POST/api/v1/accounts/{id}/2fa/disable
Parameters
| Name | In |
|---|---|
id | path |
Request body
| Field | Type |
|---|---|
code | string |
password | string |
Responses
- 204 Done, no content
- 400 Bad Request: validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: customer-only
- 429 Too Many Requests: too-many-attempts
- 500 Internal Server Error: internal
Turn on two-factor authentication
POST/api/v1/accounts/{id}/2fa/enable
Parameters
| Name | In |
|---|---|
id | path |
Request body
| Field | Type |
|---|---|
code | string |
enroll_token | string |
Responses
- 200 OK
Body
Field Type recovery_codesarray of string - 400 Bad Request: invalid-enroll-token, validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: customer-only
- 500 Internal Server Error: internal
Generate new recovery codes
POST/api/v1/accounts/{id}/2fa/recovery-codes
Parameters
| Name | In |
|---|---|
id | path |
Request body
| Field | Type |
|---|---|
code | string |
password | string |
Responses
- 200 OK
Body
Field Type recovery_codesarray of string - 400 Bad Request: validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: customer-only
- 409 Conflict: no-2fa
- 429 Too Many Requests: too-many-attempts
- 500 Internal Server Error: internal
Start two-factor authentication setup
POST/api/v1/accounts/{id}/2fa/setup
Parameters
| Name | In |
|---|---|
id | path |
Responses
- 200 OK
Body
Field Type enroll_tokenstring otpauth_uristring secretstring - 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: customer-only
- 500 Internal Server Error: internal
Stop acting as a reseller
POST/api/v1/auth/act-as/exit
Responses
- 200 OK
Body
Field Type redirectstring - 401 Unauthorized: no-session
- 403 Forbidden: csrf
- 409 Conflict: not-acting
- 500 Internal Server Error: internal
Sign in to Ky Admin
POST/api/v1/auth/login
Request body
| Field | Type |
|---|---|
password | string |
username | string |
Responses
- 200 OK
Body
Field Type aclarray of string acting_asalwaysboolean authenticatedalwaysboolean csrf_tokenstring expires_atinteger force_password_changealwaysboolean is_rootalwaysboolean mfa_requiredalwaysboolean password_expiredboolean resellerResellerBrief rolestring two_factor_enabledalwaysboolean two_factor_setup_requiredalwaysboolean usernamestring - 401 Unauthorized: invalid-credentials
- 403 Forbidden: admin-ip-not-allowed, suspended
- 429 Too Many Requests: too-many-attempts
- 500 Internal Server Error: internal
Sign out of Ky Admin
POST/api/v1/auth/logout
Responses
- 204 Done, no content
- 403 Forbidden: csrf
Ky Admin second sign-in step
POST/api/v1/auth/mfa
Request body
| Field | Type |
|---|---|
code | string |
Responses
- 200 OK
Body
Field Type aclarray of string acting_asalwaysboolean authenticatedalwaysboolean csrf_tokenstring expires_atinteger force_password_changealwaysboolean is_rootalwaysboolean mfa_requiredalwaysboolean password_expiredboolean resellerResellerBrief rolestring two_factor_enabledalwaysboolean two_factor_setup_requiredalwaysboolean usernamestring - 400 Bad Request: no-2fa
- 401 Unauthorized: invalid-code, no-session
- 403 Forbidden: csrf
- 429 Too Many Requests: too-many-attempts
- 500 Internal Server Error: internal
Ky Admin session
GET/api/v1/auth/session
Responses
- 200 OK
Body
Field Type aclarray of string acting_asalwaysboolean authenticatedalwaysboolean csrf_tokenstring expires_atinteger force_password_changealwaysboolean is_rootalwaysboolean mfa_requiredalwaysboolean password_expiredboolean resellerResellerBrief rolestring two_factor_enabledalwaysboolean two_factor_setup_requiredalwaysboolean usernamestring
Redeem a Ky Admin sign-in link
GET/api/v1/auth/sso
Redeems a Ky Admin link and opens the reseller's admin session.
Parameters
| Name | In |
|---|---|
token | query |
Responses
- 302 Redirect
- 500 Internal Server Error: internal
Turn off your two-factor authentication
POST/api/v1/me/2fa/disable
Request body
| Field | Type |
|---|---|
code | string |
Responses
- 204 Done, no content
- 400 Bad Request: validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 500 Internal Server Error: internal
Turn on your two-factor authentication
POST/api/v1/me/2fa/enable
Request body
| Field | Type |
|---|---|
code | string |
enroll_token | string |
Responses
- 204 Done, no content
- 400 Bad Request: invalid-enroll-token, validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 500 Internal Server Error: internal
Start your two-factor authentication setup
POST/api/v1/me/2fa/setup
Responses
- 200 OK
Body
Field Type enroll_tokenstring otpauth_uristring secretstring - 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 500 Internal Server Error: internal
Change your admin password
POST/api/v1/me/password
Request body
| Field | Type |
|---|---|
current_password | string |
new_password | string |
Responses
- 204 Done, no content
- 400 Bad Request: validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 500 Internal Server Error: internal
Switch from the customer panel to Ky Admin (resellers)
POST/api/v1/user/admin-link
A reseller in its customer panel switches to Ky Admin (single-use link, 60 s).
Responses
- 200 OK
Body
Field Type urlstring - 401 Unauthorized: no-session
- 403 Forbidden: csrf, impersonated, not-reseller, suspended
- 500 Internal Server Error: internal
Sign in to the customer panel
POST/api/v1/user/auth/login
Request body
| Field | Type |
|---|---|
password | string |
username | string |
Responses
- 200 OK
Body
Field Type accountmap of string authenticatedalwaysboolean csrf_tokenstring expires_atinteger featuresarray of string impersonatedalwaysboolean mfa_requiredalwaysboolean nameserversarray of string read_onlyalwaysboolean reselleralwaysboolean two_factor_setup_requiredalwaysboolean - 401 Unauthorized: invalid-credentials
- 403 Forbidden: suspended
- 409 Conflict: not-ready
- 429 Too Many Requests: too-many-attempts
- 500 Internal Server Error: internal
Sign out of the customer panel
POST/api/v1/user/auth/logout
Responses
- 204 Done, no content
- 403 Forbidden: csrf
Customer panel second sign-in step
POST/api/v1/user/auth/mfa
Request body
| Field | Type |
|---|---|
code | string |
Responses
- 200 OK
Body
Field Type accountmap of string authenticatedalwaysboolean csrf_tokenstring expires_atinteger featuresarray of string impersonatedalwaysboolean mfa_requiredalwaysboolean nameserversarray of string read_onlyalwaysboolean reselleralwaysboolean two_factor_setup_requiredalwaysboolean - 401 Unauthorized: invalid-code, no-session
- 403 Forbidden: csrf
- 429 Too Many Requests: too-many-attempts
- 500 Internal Server Error: internal
Customer panel session
GET/api/v1/user/auth/session
Responses
- 200 OK
Body
Field Type accountmap of string authenticatedalwaysboolean csrf_tokenstring expires_atinteger featuresarray of string impersonatedalwaysboolean mfa_requiredalwaysboolean nameserversarray of string read_onlyalwaysboolean reselleralwaysboolean two_factor_setup_requiredalwaysboolean - 500 Internal Server Error: internal
Redeem a customer panel sign-in link
GET/api/v1/user/auth/sso
Parameters
| Name | In |
|---|---|
token | query |
Responses
- 302 Redirect
- 500 Internal Server Error: internal