Skip to main content
POST
/
llm-application
/
open
/
document
/
upload_url
上传URL文档
curl --request POST \
  --url https://open.bigmodel.cn/api/llm-application/open/document/upload_url \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "upload_detail": [
    {
      "url": "<string>",
      "knowledge_type": 123,
      "custom_separator": [
        "<string>"
      ],
      "sentence_size": 123,
      "callback_url": "<string>",
      "callback_header": {}
    }
  ],
  "knowledge_id": "<string>"
}
'
import requests

url = "https://open.bigmodel.cn/api/llm-application/open/document/upload_url"

payload = {
"upload_detail": [
{
"url": "<string>",
"knowledge_type": 123,
"custom_separator": ["<string>"],
"sentence_size": 123,
"callback_url": "<string>",
"callback_header": {}
}
],
"knowledge_id": "<string>"
}
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({
upload_detail: [
{
url: '<string>',
knowledge_type: 123,
custom_separator: ['<string>'],
sentence_size: 123,
callback_url: '<string>',
callback_header: {}
}
],
knowledge_id: '<string>'
})
};

fetch('https://open.bigmodel.cn/api/llm-application/open/document/upload_url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/llm-application/open/document/upload_url")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upload_detail\": [\n {\n \"url\": \"<string>\",\n \"knowledge_type\": 123,\n \"custom_separator\": [\n \"<string>\"\n ],\n \"sentence_size\": 123,\n \"callback_url\": \"<string>\",\n \"callback_header\": {}\n }\n ],\n \"knowledge_id\": \"<string>\"\n}")
.asString();
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://open.bigmodel.cn/api/llm-application/open/document/upload_url"

payload := strings.NewReader("{\n \"upload_detail\": [\n {\n \"url\": \"<string>\",\n \"knowledge_type\": 123,\n \"custom_separator\": [\n \"<string>\"\n ],\n \"sentence_size\": 123,\n \"callback_url\": \"<string>\",\n \"callback_header\": {}\n }\n ],\n \"knowledge_id\": \"<string>\"\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))

}
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/llm-application/open/document/upload_url",
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([
'upload_detail' => [
[
'url' => '<string>',
'knowledge_type' => 123,
'custom_separator' => [
'<string>'
],
'sentence_size' => 123,
'callback_url' => '<string>',
'callback_header' => [

]
]
],
'knowledge_id' => '<string>'
]),
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;
}
{
  "data": {
    "successInfos": [
      {
        "documentId": "122121212",
        "url": "xxx.com"
      },
      {
        "documentId": "12121212121",
        "url": "xxx.com"
      }
    ],
    "failedInfos": [
      {
        "url": "xxx.com",
        "failReason": "不支持的文档类型"
      }
    ]
  },
  "code": 200,
  "message": "请求成功",
  "timestamp": 1689649504996
}
{
"code": 123,
"message": "<string>"
}

Authorizations

Authorization
string
header
required

标准的 HTTP Bearer 认证方式,在 API Keys 页面获取密钥。

Body

application/json
upload_detail
object[]
required

url列表

knowledge_id
string
required

知识库id

Response

请求成功

data
object
code
integer

状态码

message
string

返回信息

timestamp
integer

时间戳