> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.plextera.com/v-1/llms.txt

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

# Upload file

POST https://api.plextera.com/api/public/v1/files
Content-Type: multipart/form-data

Uploads one file, up to 50 MB.

Executable and script files are rejected.


Reference: https://docs.plextera.com/api/api-reference/files/upload-file

## Authentication

- `Authorization` header (required) — Use the API key format: `api-key <token>`.

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — File to upload. Executable and script files are rejected. Maximum size: 50 MB.

## Response

### 201

File stored. Reference it by `id` in extractions and workflow payloads.

- `id` (string, optional) — File identifier. Reference it as `fileId` in extractions and workflow payloads.
- `fileName` (string, optional) — Original file name.
- `mimeType` (string, optional) — Detected media type of the stored file.
- `size` (long, optional) — File size in bytes.
- `contentUrl` (string, optional) — Temporary, pre-signed URL to download the file content directly. Valid for a limited time; request the file again to obtain a fresh URL.

## Errors

### 400 Bad Request Error

INVALID_REQUEST — The request is malformed: unreadable JSON, an invalid parameter value, or a bad multipart body.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 401 Unauthorized Error

UNAUTHORIZED — The API key is missing, malformed, or revoked.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 403 Forbidden Error

FORBIDDEN — The API key is valid but not allowed to perform this operation.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 405 Method Not Allowed Error

METHOD_NOT_ALLOWED — The HTTP method is not supported for this path.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 406 Not Acceptable Error

NOT_ACCEPTABLE — The requested response media type is not supported.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 409 Conflict Error

CONFLICT — The request conflicts with existing state in an upstream Plextera service.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 413 Content Too Large Error

PAYLOAD_TOO_LARGE — The uploaded file exceeds the maximum supported size of 50 MB.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 415 Unsupported Media Type Error

UNSUPPORTED_MEDIA_TYPE — The uploaded file type is not allowed. Executable and script files are rejected.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 429 Too Many Requests Error

RATE_LIMITED — Too many requests in a short window. 429 responses are enforced at the network edge; the body may be plain text instead of this envelope, so rely on the status code and the Retry-After header.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 500 Internal Server Error

INTERNAL_ERROR — Unexpected failure inside Plextera. Retry with backoff; contact support with the requestId if it persists.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 502 Bad Gateway Error

DOWNSTREAM_ERROR — A downstream Plextera service failed while handling the request. Retry with backoff.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

## Types

### ApiError

Machine-readable error details shared by every error response.

- `code` (string, optional) — Stable machine-readable error code. Branch your handling on this, not on `message`.
- `message` (string, optional) — Human-readable explanation. Wording may change; do not parse it.
- `requestId` (string, optional) — Unique request identifier, also returned in the X-Request-Id response header. Include it in support requests.
- `retryable` (boolean, optional) — True when retrying the same request later may succeed.
- `details` (list of ApiErrorDetail, optional) — Field-level validation issues. Present only for VALIDATION_FAILED.

### ApiErrorDetail

Field-level validation issue.

- `field` (string, optional) — Name of the invalid request field.
- `issue` (string, optional) — What is wrong with the field value.

## Examples

**Request**

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

**Response**

```json
{
  "id": "file_01JY7M4ZVX5R1P3M3Q0TA1S7ZM",
  "fileName": "invoice.pdf",
  "mimeType": "application/pdf",
  "size": 63877,
  "contentUrl": "https://files.plextera.com/acme/2026/06/23/invoice_01JY7M4ZVX.pdf?Expires=1782825600&KeyName=key1&Signature=abc123"
}
```

**SDK Code**

```python Stored file
import requests

url = "https://api.plextera.com/api/public/v1/files"

files = { "file": "open('string', 'rb')" }
headers = {"Authorization": "<apiKey>"}

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

print(response.json())
```

```javascript Stored file
const url = 'https://api.plextera.com/api/public/v1/files';
const form = new FormData();
form.append('file', 'string');

const options = {method: 'POST', headers: {Authorization: '<apiKey>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Stored file
package main

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

func main() {

	url := "https://api.plextera.com/api/public/v1/files"

	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\n")

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

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Stored file
require 'uri'
require 'net/http'

url = URI("https://api.plextera.com/api/public/v1/files")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
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\n"

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

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

HttpResponse<String> response = Unirest.post("https://api.plextera.com/api/public/v1/files")
  .header("Authorization", "<apiKey>")
  .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\n")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.plextera.com/api/public/v1/files', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

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

```csharp Stored file
using RestSharp;

var client = new RestClient("https://api.plextera.com/api/public/v1/files");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
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\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Stored file
import Foundation

let headers = ["Authorization": "<apiKey>"]
let parameters = [
  [
    "name": "file",
    "fileName": "string"
  ]
]

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://api.plextera.com/api/public/v1/files")! 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()
```