> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.skaitra.com/api/api-zinynas/documents/create/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.skaitra.com/_mcp/server. # Create a document from a file POST https://jusu-agentura.skaitra.com/api/v1/documents Content-Type: application/json Files an uploaded file (POST /files) as a document of a company. It arrives in Gautieji like any other document and is read by OCR. A file becomes at most one document. Reference: https://docs.skaitra.com/api/api-zinynas/documents/create ## Authentication - `Authorization` header (bearer token, required) — Skaitra API key (`skt_…`). - `Authorization` header (bearer token, required) — OAuth 2.1 access token issued for the Skaitra resource (`/mcp`); see /.well-known/oauth-protected-resource. ## Request ### Headers - `Idempotency-Key` (string, optional) — Any unique value; a retry with the same key returns the first result. ### Body (application/json) This endpoint expects an object. - `fileId` (string, required) - `companyId` (string, required) - `filename` (string, optional) ## Response ### 201 OK - `id` (string, required) - `accountingDocumentId` (integer, required, nullable) - `companyId` (string, required, nullable) - `name` (string, required) - `originalFilename` (string, required) - `source` (string, required) - `receivedAt` (string, required) - `stage` (enum, required) - Allowed values: `inbox`, `accounting`, `storage`, `archived`, `split`, `error` - `destination` (enum, required, nullable) - Allowed values: `accounting`, `storage`, `none` - `duplicateOfDocumentId` (string, required, nullable) - `file` (DocumentFile, required, nullable) - `createdAt` (string, required) - `updatedAt` (string, required) ## Errors ### 400 Bad Request Error The request is invalid; `error.details.issues` lists the problems. - `error` (ErrorError, required) ### 401 Unauthorized Error The API key is missing, invalid, expired or revoked. - `error` (ErrorError, required) ### 403 Forbidden Error The key lacks a scope or access to the company. - `error` (ErrorError, required) ### 404 Not Found Error Not found, or not visible to this key. - `error` (ErrorError, required) ### 409 Conflict Error A request with the same Idempotency-Key is still running. - `error` (ErrorError, required) ### 412 Precondition Failed Error The resource changed since you read it (If-Match). - `error` (ErrorError, required) ### 422 Unprocessable Entity Error The Idempotency-Key was used for a different request. - `error` (ErrorError, required) ### 428 Precondition Error The operation needs If-Match. - `error` (ErrorError, required) ## Types ### DocumentFile - `sizeBytes` (integer, required) - `mimeType` (string, required) - `sha256` (string, required) ### ErrorError - `code` (enum, required) - Allowed values: `INVALID_API_KEY`, `INSUFFICIENT_SCOPE`, `COMPANY_ACCESS_DENIED`, `NOT_FOUND`, `VALIDATION_ERROR`, `INVALID_CURSOR`, `METHOD_NOT_ALLOWED`, `PRECONDITION_REQUIRED`, `PRECONDITION_FAILED`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_KEY_IN_USE`, `CONFLICT`, `PAYLOAD_TOO_LARGE`, `UNSUPPORTED_MEDIA_TYPE`, `STORAGE_UNAVAILABLE`, `FORBIDDEN`, `FEATURE_NOT_INCLUDED`, `RATE_LIMITED`, `APPROVAL_REQUIRED`, `APPROVAL_PENDING`, `APPROVAL_REJECTED`, `INTERNAL_ERROR` - `message` (string, required) - `hint` (string, optional) - `details` (map from string to any, optional) ## Examples **Request** ```json { "fileId": "string", "companyId": "string" } ``` **Response** ```json { "id": "string", "accountingDocumentId": 1, "companyId": "string", "name": "string", "originalFilename": "string", "source": "string", "receivedAt": "string", "stage": "inbox", "destination": "accounting", "duplicateOfDocumentId": "string", "file": { "sizeBytes": 1, "mimeType": "string", "sha256": "string" }, "createdAt": "string", "updatedAt": "string" } ``` **SDK Code** ```python import requests url = "https://jusu-agentura.skaitra.com/api/v1/documents" payload = { "fileId": "string", "companyId": "string" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://jusu-agentura.skaitra.com/api/v1/documents'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"fileId":"string","companyId":"string"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://jusu-agentura.skaitra.com/api/v1/documents" payload := strings.NewReader("{\n \"fileId\": \"string\",\n \"companyId\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://jusu-agentura.skaitra.com/api/v1/documents") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"fileId\": \"string\",\n \"companyId\": \"string\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://jusu-agentura.skaitra.com/api/v1/documents") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"fileId\": \"string\",\n \"companyId\": \"string\"\n}") .asString(); ``` ```php request('POST', 'https://jusu-agentura.skaitra.com/api/v1/documents', [ 'body' => '{ "fileId": "string", "companyId": "string" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://jusu-agentura.skaitra.com/api/v1/documents"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"fileId\": \"string\",\n \"companyId\": \"string\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "fileId": "string", "companyId": "string" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://jusu-agentura.skaitra.com/api/v1/documents")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```