静态导出
启动静态导出作业
为部署启动一个静态导出任务。该任务会将你的文档预渲染为一组自包含的静态 HTML、RSC 及资源文件。返回一个任务 ID,可用于轮询状态;任务完成后,还可用它生成可下载的软件包。
静态导出仅适用于 Enterprise 套餐。
POST
/
static-export
/
jobs
启动静态导出任务
curl --request POST \
--url https://api.mintlify.com/v1/static-export/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "docs.example.com",
"version": "2024-06-01",
"paths": [
"index",
"guides/getting-started",
"api-reference/introduction"
]
}
'import requests
url = "https://api.mintlify.com/v1/static-export/jobs"
payload = {
"domain": "docs.example.com",
"version": "2024-06-01",
"paths": ["index", "guides/getting-started", "api-reference/introduction"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
domain: 'docs.example.com',
version: '2024-06-01',
paths: ['index', 'guides/getting-started', 'api-reference/introduction']
})
};
fetch('https://api.mintlify.com/v1/static-export/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mintlify.com/v1/static-export/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'domain' => 'docs.example.com',
'version' => '2024-06-01',
'paths' => [
'index',
'guides/getting-started',
'api-reference/introduction'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/static-export/jobs"
payload := strings.NewReader("{\n \"domain\": \"docs.example.com\",\n \"version\": \"2024-06-01\",\n \"paths\": [\n \"index\",\n \"guides/getting-started\",\n \"api-reference/introduction\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.mintlify.com/v1/static-export/jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"docs.example.com\",\n \"version\": \"2024-06-01\",\n \"paths\": [\n \"index\",\n \"guides/getting-started\",\n \"api-reference/introduction\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/static-export/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"domain\": \"docs.example.com\",\n \"version\": \"2024-06-01\",\n \"paths\": [\n \"index\",\n \"guides/getting-started\",\n \"api-reference/introduction\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jobId": "se_3f9a2c1b8e7d4a06",
"status": "running",
"progress": 42,
"pageCount": 128,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}静态导出需要 Enterprise 套餐。
domain 字段是提供你的文档服务的主机名——即你在 Mintlify 控制台中为项目配置的自定义域名(例如 docs.example.com);如果你尚未设置自定义域名,则使用你的 Mintlify 子域名(例如 acme.mintlify.app)。仅传入主机名,不要包含协议或任何路径前缀。授权
管理员 API 密钥。可在控制台的 API 密钥页面生成。
请求体
application/json
要导出的部署的主域名。使用你在 Mintlify 控制台中为项目配置的自定义域名(例如 docs.example.com)。如果尚未配置自定义域名,则使用你的 Mintlify 子域名(例如 acme.mintlify.app)。仅提供主机名——不要包含协议、结尾斜杠或诸如 /docs 之类的路径前缀。
示例:
"docs.example.com"
用于标记此次导出的可选版本标签。默认为最新发布的版本。
示例:
"2024-06-01"
要包含的页面路径的可选列表。省略时,将导出所有已发布的页面。
示例:
[
"index",
"guides/getting-started",
"api-reference/introduction"
]响应
导出任务已被接受并加入队列。
静态导出任务的唯一标识符。
示例:
"se_3f9a2c1b8e7d4a06"
任务的当前状态。
可用选项:
queued, running, completed, failed 示例:
"running"
完成百分比,范围为 0 到 100。
必填范围:
0 <= x <= 100示例:
42
目前已导出的页面数量。
示例:
128
任务的创建时间。
任务的最后更新时间。
人类可读的错误消息。仅当 status 为 failed 时才会出现。
⌘I
启动静态导出任务
curl --request POST \
--url https://api.mintlify.com/v1/static-export/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "docs.example.com",
"version": "2024-06-01",
"paths": [
"index",
"guides/getting-started",
"api-reference/introduction"
]
}
'import requests
url = "https://api.mintlify.com/v1/static-export/jobs"
payload = {
"domain": "docs.example.com",
"version": "2024-06-01",
"paths": ["index", "guides/getting-started", "api-reference/introduction"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
domain: 'docs.example.com',
version: '2024-06-01',
paths: ['index', 'guides/getting-started', 'api-reference/introduction']
})
};
fetch('https://api.mintlify.com/v1/static-export/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mintlify.com/v1/static-export/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'domain' => 'docs.example.com',
'version' => '2024-06-01',
'paths' => [
'index',
'guides/getting-started',
'api-reference/introduction'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/static-export/jobs"
payload := strings.NewReader("{\n \"domain\": \"docs.example.com\",\n \"version\": \"2024-06-01\",\n \"paths\": [\n \"index\",\n \"guides/getting-started\",\n \"api-reference/introduction\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.mintlify.com/v1/static-export/jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"docs.example.com\",\n \"version\": \"2024-06-01\",\n \"paths\": [\n \"index\",\n \"guides/getting-started\",\n \"api-reference/introduction\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/static-export/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"domain\": \"docs.example.com\",\n \"version\": \"2024-06-01\",\n \"paths\": [\n \"index\",\n \"guides/getting-started\",\n \"api-reference/introduction\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jobId": "se_3f9a2c1b8e7d4a06",
"status": "running",
"progress": 42,
"pageCount": 128,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}