创建接口token
curl --request POST \
--url https://api.maxapi.ai/api/user/createApiToken \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"uid": "xxx",
"limit": 10
}
'import requests
url = "https://api.maxapi.ai/api/user/createApiToken"
payload = {
"uid": "xxx",
"limit": 10
}
headers = {
"Content-Type": "<content-type>",
"Api-Key": "<api-key>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', 'Api-Key': '<api-key>'},
body: JSON.stringify({uid: 'xxx', limit: 10})
};
fetch('https://api.maxapi.ai/api/user/createApiToken', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/api/user/createApiToken"
payload := strings.NewReader("{\n \"uid\": \"xxx\",\n \"limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxapi.ai/api/user/createApiToken")
.header("Content-Type", "<content-type>")
.header("Api-Key", "<api-key>")
.body("{\n \"uid\": \"xxx\",\n \"limit\": 10\n}")
.asString();{
"data": {
"token": "YOUR_API_KEY",
"expireTime": 7200
},
"code": 0,
"message": "操作成功"
}注意:该接口请在服务端调用,同一个 uid 创建 token 时,之前通过该 uid 创建的 token 会在10秒内过期 场景说明:在UI集成中,为防止 token 滥用,limit 参数可以让第三方集成商维护自己平台用户的使用次数,未注册用户访问时可以创建 limit 为 0 的 token ,用户能使用但生成不了PPT,UI中监听次数用完的事件指导用户登录,登录用户访问时可以根据系统 vip 级别限制和维护系统用户 limit 次数
POST
https://api.maxapi.ai
/
api
/
user
/
createApiToken
创建接口token
curl --request POST \
--url https://api.maxapi.ai/api/user/createApiToken \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"uid": "xxx",
"limit": 10
}
'import requests
url = "https://api.maxapi.ai/api/user/createApiToken"
payload = {
"uid": "xxx",
"limit": 10
}
headers = {
"Content-Type": "<content-type>",
"Api-Key": "<api-key>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', 'Api-Key': '<api-key>'},
body: JSON.stringify({uid: 'xxx', limit: 10})
};
fetch('https://api.maxapi.ai/api/user/createApiToken', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/api/user/createApiToken"
payload := strings.NewReader("{\n \"uid\": \"xxx\",\n \"limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxapi.ai/api/user/createApiToken")
.header("Content-Type", "<content-type>")
.header("Api-Key", "<api-key>")
.body("{\n \"uid\": \"xxx\",\n \"limit\": 10\n}")
.asString();{
"data": {
"token": "YOUR_API_KEY",
"expireTime": 7200
},
"code": 0,
"message": "操作成功"
}