FileService
Create File Upload
Reserves a file and returns a short-lived presigned POST form to upload it
to. Submit the form as multipart/form-data with the returned fields first
and the bytes in a trailing file part. The upload is unusable until
ConfirmFileUpload accepts it.
Required scope: documents:write
Error Codes:
- DEVELOPER.SCOPE_INSUFFICIENT: The key lacks the documents:write scope.
- FILE.INVALID_CONTENT_TYPE: The content type is not application/pdf.
- FILE.INVALID_SIZE: size_bytes is zero, negative, or above the limit.
- FILE.PENDING_LIMIT_EXCEEDED: Too many unconfirmed uploads for the key owner.
POST
/
developer
/
v1
/
files
Create File Upload
curl --request POST \
--url https://app.doodocs.kz/api/developer/v1/files \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"content_type": "<string>",
"filename": "<string>",
"size_bytes": "<string>"
}
'import requests
url = "https://app.doodocs.kz/api/developer/v1/files"
payload = {
"content_type": "<string>",
"filename": "<string>",
"size_bytes": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({content_type: '<string>', filename: '<string>', size_bytes: '<string>'})
};
fetch('https://app.doodocs.kz/api/developer/v1/files', 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://app.doodocs.kz/api/developer/v1/files",
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([
'content_type' => '<string>',
'filename' => '<string>',
'size_bytes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.doodocs.kz/api/developer/v1/files"
payload := strings.NewReader("{\n \"content_type\": \"<string>\",\n \"filename\": \"<string>\",\n \"size_bytes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.doodocs.kz/api/developer/v1/files")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content_type\": \"<string>\",\n \"filename\": \"<string>\",\n \"size_bytes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.doodocs.kz/api/developer/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content_type\": \"<string>\",\n \"filename\": \"<string>\",\n \"size_bytes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"file": {
"content_type": "<string>",
"create_time": "2023-11-07T05:31:56Z",
"filename": "<string>",
"id": "<string>",
"size_bytes": "<string>",
"status": "FILE_UPLOAD_STATUS_UNSPECIFIED"
},
"upload": {
"expires_at": "2023-11-07T05:31:56Z",
"fields": {},
"url": "<string>"
}
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}Авторизации
Тело
application/json
Must be application/pdf: the file is attached as the document's PDF as it is, without conversion.
Filename to store the file under (shown when downloading).
Exact size of the bytes to upload; storage rejects a larger object.
⌘I
Create File Upload
curl --request POST \
--url https://app.doodocs.kz/api/developer/v1/files \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"content_type": "<string>",
"filename": "<string>",
"size_bytes": "<string>"
}
'import requests
url = "https://app.doodocs.kz/api/developer/v1/files"
payload = {
"content_type": "<string>",
"filename": "<string>",
"size_bytes": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({content_type: '<string>', filename: '<string>', size_bytes: '<string>'})
};
fetch('https://app.doodocs.kz/api/developer/v1/files', 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://app.doodocs.kz/api/developer/v1/files",
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([
'content_type' => '<string>',
'filename' => '<string>',
'size_bytes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.doodocs.kz/api/developer/v1/files"
payload := strings.NewReader("{\n \"content_type\": \"<string>\",\n \"filename\": \"<string>\",\n \"size_bytes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.doodocs.kz/api/developer/v1/files")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content_type\": \"<string>\",\n \"filename\": \"<string>\",\n \"size_bytes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.doodocs.kz/api/developer/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content_type\": \"<string>\",\n \"filename\": \"<string>\",\n \"size_bytes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"file": {
"content_type": "<string>",
"create_time": "2023-11-07T05:31:56Z",
"filename": "<string>",
"id": "<string>",
"size_bytes": "<string>",
"status": "FILE_UPLOAD_STATUS_UNSPECIFIED"
},
"upload": {
"expires_at": "2023-11-07T05:31:56Z",
"fields": {},
"url": "<string>"
}
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}