> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.lumenia.net/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.lumenia.net/_mcp/server.

# Upload an organization document

POST https://app.lumenia.net/api/v1/organizations/{orgId}/documents
Content-Type: multipart/form-data

Upload a document to an organization.

Reference: https://docs.lumenia.net/api-reference/documents/upload-an-organization-document

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <API_KEY>`, where `API_KEY` is your API key.

## Request

### Path parameters

- `orgId` (string, required) — Organization that will store the document.

### Headers

- `X-Account-Id` (string, required) — Account that owns the organization.

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — Document to upload. Supported file types: pdf, docx, pptx, odt, odp, txt, md, rst, adoc, org, html, csv, epub. File size limits apply.
- `folder` (string, optional) — Target folder name. Must already exist. Defaults to custom-documents when omitted.

## Response

### 201

The uploaded and processed document.

- `document` (V1OrganizationsOrgIdDocumentsPostResponsesContentApplicationJsonSchemaDocument, required) — The stored document, in the lean shape.

## Errors

### 400 Bad Request Error

Missing file, unsupported file type, or invalid folder

- `any`

### 403 Forbidden Error

The API key is missing or invalid, or the X-Account-Id does not belong to the partner.

- `message` (string, optional)

### 404 Not Found Error

Organization or folder not found

- `any`

### 413 Content Too Large Error

File too large

- `any`

### 500 Internal Server Error

Internal Server Error

- `any`

## Types

### V1OrganizationsOrgIdDocumentsPostResponsesContentApplicationJsonSchemaDocument

The stored document, in the lean shape.

- `id` (string, optional) — The sole identifier for the document.
- `folder` (string, optional) — The folder the document was stored in.
- `title` (string, optional, nullable) — The document title, usually the original filename.
- `mimeType` (string, optional, nullable) — The MIME type of the source file.
- `wordCount` (integer, optional, nullable) — Word count of the extracted text.
- `tokenCountEstimate` (integer, optional, nullable) — Estimated token count of the extracted text.
- `watched` (boolean, optional) — Whether the document is watched for upstream changes. Always false on upload.
- `createdAt` (string, optional, nullable) — ISO 8601 timestamp of when the document was stored.

## Examples

**Request**

```json
{
  "file": "<file: string>"
}
```

**Response**

```json
{
  "document": {
    "id": "b927e9d2-ad7c-442b-9280-32b56d105629",
    "folder": "custom-documents",
    "title": "handbook.pdf",
    "mimeType": "application/pdf",
    "wordCount": 1280,
    "tokenCountEstimate": 1600,
    "watched": false,
    "createdAt": "2026-06-15T05:24:00.000Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.lumenia.net/api/v1/organizations/orgId/documents"

files = { "file": "open('string', 'rb')" }
payload = { "folder":  }
headers = {
    "X-Account-Id": "X-Account-Id",
    "Authorization": "Bearer <API_KEY>"
}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.lumenia.net/api/v1/organizations/orgId/documents';
const form = new FormData();
form.append('file', 'string');
form.append('folder', '');

const options = {
  method: 'POST',
  headers: {'X-Account-Id': 'X-Account-Id', Authorization: 'Bearer <API_KEY>'}
};

options.body = form;

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://app.lumenia.net/api/v1/organizations/orgId/documents"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Account-Id", "X-Account-Id")
	req.Header.Add("Authorization", "Bearer <API_KEY>")

	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://app.lumenia.net/api/v1/organizations/orgId/documents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Account-Id"] = 'X-Account-Id'
request["Authorization"] = 'Bearer <API_KEY>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.lumenia.net/api/v1/organizations/orgId/documents")
  .header("X-Account-Id", "X-Account-Id")
  .header("Authorization", "Bearer <API_KEY>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.lumenia.net/api/v1/organizations/orgId/documents', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <API_KEY>',
    'X-Account-Id' => 'X-Account-Id',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.lumenia.net/api/v1/organizations/orgId/documents");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Account-Id", "X-Account-Id");
request.AddHeader("Authorization", "Bearer <API_KEY>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Id": "X-Account-Id",
  "Authorization": "Bearer <API_KEY>"
]
let parameters = [
  [
    "name": "file",
    "fileName": "string"
  ],
  [
    "name": "folder",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://app.lumenia.net/api/v1/organizations/orgId/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()
```