> This documentation belongs to Invofox, an AI-powered document processing
> platform. The API extracts structured data (fields) from unstructured
> documents (invoices, contracts, forms, bank statements, and more).
> Key concepts: Account, Environment, Document Type, Field, File, Import,
> and Document. When answering, prefer the exact terminology defined in the
> Glossary and cite the relevant API Reference endpoint when applicable.

# Upload single file by URL

POST https://api.invofox.com/v1/ingest/single-url
Content-Type: application/json

Upload a single file by providing a URL from which the file will be downloaded and processed.

Allowed formats are:
- Images: .jpeg, .jpg, .png, .tiff
- PDFs: .pdf

The API accepts a single URL with optional metadata for processing.

**Key Features:**
- Single file only (no batch processing)
- No compression support
- Splitter functionality is disabled
- Pre-assigned DocumentId returned immediately

**Important:** Only HTTPS URLs are allowed for security reasons.

**DEPRECATED:** This endpoint will be removed. Use the batch upload endpoint (`/upload-by-url`) instead, which supports single or multiple URLs.

Reference: https://developers.invofox.com/api-reference/ingest-reference/files/upload-single-url-controller-upload-single-url

## Authentication

- `x-api-key` header (required) — API key authentication for programmatic access. Used by server-to-server integrations and API clients.
- `x-access-token` header (required) — Access token authentication for web users. Used by browser-based applications and authenticated user sessions.

## Request

### Body (application/json)

This endpoint expects an UploadSingleUrlRequestDto.

- `url` (string, required) — Single file URL to download and process. **Important:** Only HTTPS URLs are allowed for security reasons. The file will be downloaded from this URL and processed as a single document without splitting. **Allowed formats:** - Images: .jpeg, .jpg, .png, .tiff - PDFs: .pdf
- `filename` (string, optional) — Optional filename for the document. If not provided, the filename will be extracted from the URL.
- `info` (SingleUrlFileInfo, optional) — Metadata and configuration for the single file being uploaded. **Single-File Context:** All metadata in this field applies to the one file being uploaded. This is the simplest upload pattern - no dual-level metadata structure needed. **Available Settings:** - company: Company ID for this file - type: Document type (e.g., 'invoice', 'receipt') - data: Processing data for this file - clientData: Client metadata for this file

## Response

### 201

File queued for download and processing with pre-assigned DocumentId

- `accountId` (string, required) — Account ID
- `environmentId` (string, required) — Environment ID
- `importId` (string, required) — Import ID for tracking the upload process
- `fileId` (string, required) — File ID for the uploaded file
- `filename` (string, required) — Original filename
- `documentId` (string, required, deprecated) — Pre-assigned Document ID. DEPRECATED: This field will be removed. Instead, use webhooks to receive processing notifications, then retrieve documentIds from the file details endpoint.

## Errors

### 400 Bad Request Error

Bad Request - Invalid URL or validation errors

- `message` (V1IngestSingleUrlPostResponsesContentApplicationJsonSchemaMessage, optional)
- `error` (string, optional)
- `statusCode` (double, optional)

### 404 Not Found Error

Not Found - URL is unreachable

- `message` (string, optional)
- `error` (string, optional)
- `statusCode` (double, optional)

## Types

### SingleUrlFileInfo

- `useSplitter` (boolean, optional) — Flag to determine if splitter should be used to process this file. This will be ignored if splitter is not enabled for the environment
- `useClassifier` (boolean, optional) — Flag to determine if classifier should be used to detect this file's document type. This will be ignored if classifier is not enabled for the environment
- `type` (string, optional) — Document type ID or alias (e.g., "invoice", "receipt", or a custom type ID from your environment). This field is optional if the classifier is enabled for the environment or if a defaultType is configured in your ImportConfig; otherwise, it is required.
- `data` (map from string to any, optional) — Data known for the file. This data will be associated to the file itself.
- `clientData` (map from string to any, optional) — Custom metadata object for your application's use (not processed by Invofox). Useful for storing external IDs, tracking information, or application-specific context.
- `company` (string, optional) — Company ID (MongoDB ObjectId)

### V1IngestSingleUrlPostResponsesContentApplicationJsonSchemaMessage

## Examples

**Request**

```json
{
  "url": "https://example.com/invoice.pdf"
}
```

**Response**

```json
{
  "accountId": "000000000000000000000007",
  "environmentId": "000000000000000000000008",
  "importId": "000000000000000000000009",
  "fileId": "00000000000000000000000b",
  "filename": "document.pdf",
  "documentId": "00000000000000000000000a"
}
```

**SDK Code**

```python
import requests

url = "https://api.invofox.com/v1/ingest/single-url"

payload = { "url": "https://example.com/invoice.pdf" }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.invofox.com/v1/ingest/single-url';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"url":"https://example.com/invoice.pdf"}'
};

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://api.invofox.com/v1/ingest/single-url"

	payload := strings.NewReader("{\n  \"url\": \"https://example.com/invoice.pdf\"\n}")

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

	req.Header.Add("x-api-key", "<apiKey>")
	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://api.invofox.com/v1/ingest/single-url")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"https://example.com/invoice.pdf\"\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://api.invofox.com/v1/ingest/single-url")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"https://example.com/invoice.pdf\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.invofox.com/v1/ingest/single-url', [
  'body' => '{
  "url": "https://example.com/invoice.pdf"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.invofox.com/v1/ingest/single-url");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"url\": \"https://example.com/invoice.pdf\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["url": "https://example.com/invoice.pdf"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.invofox.com/v1/ingest/single-url")! 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()
```