PDF to Office
async conversion — Query result
Query conversion status by task_id and receive the result file download URL
POST
/
pdf2office
/
async_check
Python
import time
import requests
url = "https://somark.cn/api/v1/pdf2office/async_check"
task_id = "c5e6c983f28a4e6eb5d6c061343a8642"
while True:
response = requests.post(url, data={
"task_id": task_id,
"api_key": "sk-***",
})
result = response.json()["data"]
if result["status"] == "succeeded":
print(result["download_url"])
break
if result["status"] == "failed":
print(result["error_message"])
break
time.sleep(3)curl -X POST https://somark.cn/api/v1/pdf2office/async_check \
-F "task_id=c5e6c983f28a4e6eb5d6c061343a8642" \
-F "api_key=sk-***"const form = new FormData();
form.append('task_id', 'c5e6c983f28a4e6eb5d6c061343a8642');
form.append('api_key', 'sk-***');
const options = {method: 'POST'};
options.body = form;
fetch('https://somark.cn/api/v1/pdf2office/async_check', 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://somark.cn/api/v1/pdf2office/async_check",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\nc5e6c983f28a4e6eb5d6c061343a8642\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nsk-***\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$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://somark.cn/api/v1/pdf2office/async_check"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\nc5e6c983f28a4e6eb5d6c061343a8642\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nsk-***\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://somark.cn/api/v1/pdf2office/async_check")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\nc5e6c983f28a4e6eb5d6c061343a8642\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nsk-***\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://somark.cn/api/v1/pdf2office/async_check")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\nc5e6c983f28a4e6eb5d6c061343a8642\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nsk-***\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "查询成功",
"data": {
"task_id": "c5e6c983f28a4e6eb5d6c061343a8642",
"status": "succeeded",
"target_type": "word",
"layout_mode": "flow",
"file_name": "document.pdf",
"page_num": 12,
"result_file_name": "document.docx",
"error_code": null,
"error_message": null,
"created_at": "2026-08-24T10:00:00",
"started_at": "2026-08-24T10:00:10",
"finished_at": "2026-08-24T10:01:20",
"download_url": "https://example.com/result.docx?signature=***",
"expires_in": 1800
}
}Task statuses
status | Meaning |
|---|---|
parsing | The PDF is being parsed |
queued | Parsing is complete and conversion is queued |
converting | The Office file is being generated |
succeeded | Conversion succeeded and the response includes download_url |
failed | Parsing or conversion failed; inspect error_code and error_message |
download_url is a short-lived signed URL. If it expires, call this endpoint again to obtain a new URL.
If you do not have a task_id, call Submit async task first.
