Tài liệu API
Tài liệu API JSON: endpoint lấy mã 2FA, tra cứu IP, DNS, WHOIS và chuyển đổi dữ liệu. Kèm cách xác thực bằng khoá Bearer, hạn mức gọi và ví dụ curl cho từng lệnh.
Xác thực
Create a key under Account → API keys, then send it as a
bearer token. X-API-Key and ?api_key= also work for quick tests.
curl -s https://authbeta.com/api/v1/status \ -H "Authorization: Bearer ab_xxxxxxxxxxxxxxxxxxxx"
Base URL: https://authbeta.com/api/v1 · Every response is JSON with an ok flag.
Giới hạn tần suất
Each key has its own per-minute budget (default 120).
Responses carry X-RateLimit-Limit, X-RateLimit-Remaining and
X-RateLimit-Reset; going over returns 429 with a Retry-After header.
Lỗi
| Status | Meaning |
|---|---|
| 400 | A required field is missing. |
| 401 | Key missing, invalid, disabled or expired. |
| 403 | The key lacks the scope this endpoint needs. |
| 404 | Unknown endpoint or vault entry. |
| 422 | The input was understood but cannot be used. |
| 429 | Rate limit exceeded. |
| 503 | The API is switched off by the administrator. |
{"ok": false, "error": "The \"secret\" field must be a valid base32 string."}
Danh sách endpoint
/totp
scope: totp
Generate a code from a secret, otpauth link or free text.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| secret | uri | input | string | có | The base32 secret, an otpauth:// link, or text containing one. |
| digits | int | không | 4-10, default 6 |
| period | int | không | Seconds, default 30 |
| algorithm | string | không | SHA1 | SHA256 | SHA512 | STEAM |
| counter | int | không | Present = HOTP mode |
| timestamp | int | không | Unix time to compute the code at |
| include_secret | bool | không | Echo the secret back, default false |
/totp/verify
scope: totp
Check whether a code matches a secret.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| secret | string | có | Base32 secret |
| code | string | có | The code to verify |
| window | int | không | Allowed drift in steps, 0-10, default 1 |
/totp/secret
scope: totp
Create a new random secret and its otpauth link.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| bytes | int | không | 10-64, default 20 (160 bit) |
| label | string | không | Account name |
| issuer | string | không | Service name |
/totp/qr
scope: totp
Render a QR code as PNG or SVG.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| text | secret | string | có | Arbitrary text, or a secret to build an otpauth link from |
| format | string | không | png (default) or svg |
| scale | int | không | 2-20, pixels per module |
| ecc | string | không | L | M | Q | H |
| raw | bool | không | Return the image itself instead of JSON |
/totp/decode
scope: totp
Read a QR image and return the 2FA data it holds.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| image | string | có | Base64 image data, with or without the data: prefix |
/totp/bulk
scope: totp
Codes for a whole list at once.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| text | string | có | One entry per line |
| delimiter | string | không | auto (default), pipe, comma, tab, … |
| include_secret | bool | không | Echo secrets back, default false |
/password
scope: password
Generate one or more passwords.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| mode | string | không | random | memorable | pin | hex | base64 | uuid |
| length | int | không | 4-256 |
| quantity | int | không | 1-50 |
| lowercase, uppercase, digits, symbols | bool | không | Character sets for random mode |
| exclude_ambiguous, no_repeat, no_sequential | bool | không | Extra rules |
| words | int | không | 2-12 for memorable mode |
/password/strength
scope: password
Score a password.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| password | string | có | The password to analyse |
/ip/{ip}
scope: ip
Details for an IP address. Without {ip}, your own address is used.
/dns
scope: ip
DNS records for a hostname.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| host | string | có | Domain name |
| type | string | không | Comma separated list, default A,AAAA,MX,NS,TXT |
/whois
scope: ip
WHOIS data for a domain or IP.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| query | string | có | Domain or IP |
/ports
scope: ip
Check whether TCP or UDP ports accept traffic. TCP returns open/closed/filtered; UDP returns open, closed (ICMP unreachable) or open|filtered when the port stays silent.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| host | string | có | Hostname or IP address |
| protocol | string | không | tcp (default) or udp |
| ports | array|string | không | List of ports, or "53,123,161". Defaults to the common ports for the chosen protocol. |
/email-security
scope: ip
SPF, DMARC, MX, MTA-STS and TLS-RPT for a domain.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| domain | string | có | Domain name |
/text
scope: text
Run a text operation.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| text | string | có | Input text |
| operation | string | có | See the list of operations below |
| … | mixed | không | Operation specific parameters (delimiter, column, find, replace…) |
/vault
scope: vault
List your saved 2FA accounts with current codes.
/vault/{id}/code
scope: vault
Current code for one vault entry. HOTP entries advance the counter.
/status
Details about the key you are using.
Example
curl -s https://authbeta.com/api/v1/totp \
-H "Authorization: Bearer ab_xxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"secret":"JBSWY3DPEHPK3PXP","digits":6}'
{
"ok": true,
"result": {
"issuer": "", "label": "", "digits": 6, "period": 30,
"algorithm": "SHA1", "type": "totp",
"code": "123456", "next_code": "654321",
"expires_in": 17, "server_time": 1771200000
}
}
Text operations
Values accepted by the operation field of POST /text:
trim_lines
remove_empty
remove_duplicates
sort_asc
sort_desc
sort_natural
sort_length
shuffle
reverse_lines
reverse_text
number_lines
unique_count
extract_column
replace_delimiter
add_prefix_suffix
wrap_lines
find_replace
regex_replace
upper
lower
title
sentence
camel
snake
kebab
toggle_case
remove_spaces
collapse_spaces
remove_accents
slugify
base64_encode
base64_decode
url_encode
url_decode
html_encode
html_decode
hex_encode
hex_decode
json_escape
json_pretty
json_minify
extract_emails
extract_urls
extract_ips
extract_numbers
extract_secrets
hash_md5
hash_sha1
hash_sha256
hash_sha512
hash_crc32
join_lines
split_length
count_stats