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

# Create a presigned upload URL for an input file

POST https://api.segmentationapi.com/v1/uploads/presign
Content-Type: application/json

Request a short-lived S3 PUT URL and a task ID for an image or video file. PUT the bytes to uploadUrl with the same Content-Type, then pass the task ID to createJob.


Reference: https://docs.segmentationapi.com/api-reference/uploads/create-upload-presign

## Authentication

- `Authorization` header (required) — Unrestricted secret `sk_live_...` or Cognito access token in `Authorization: Bearer ...`

## Request

### Body (application/json)

This endpoint expects a PresignUploadRequest.

- `contentType` (string, required) — An image or video MIME type, or application/octet-stream.

## Response

### 200

Presigned upload URL and object key

- `uploadUrl` (string, required)
- `taskId` (string, required) — Opaque upload id. Includes the file extension so create-job can address the object without listing the inputs prefix (for example a1b2c3d4-e5f6-7890-abcd-ef1234567890.png).
- `bucket` (string, required)
- `expiresIn` (integer, required)

## Errors

### 400 Bad Request Error

Invalid request

- `error` (string, required)
- `message` (string, optional)
- `remainingTokens` (integer, optional)
- `requestedTokens` (integer, optional)
- `expiresAt` (datetime, optional)
- `activeJobId` (string, optional)
- `upgradeUrl` (string, optional)
- `retryAfterSeconds` (integer, optional)

### 401 Unauthorized Error

Authentication is missing, invalid, or expired

- `error` (string, required)
- `message` (string, optional)
- `remainingTokens` (integer, optional)
- `requestedTokens` (integer, optional)
- `expiresAt` (datetime, optional)
- `activeJobId` (string, optional)
- `upgradeUrl` (string, optional)
- `retryAfterSeconds` (integer, optional)

### 500 Internal Server Error

Internal server error

- `error` (string, required)
- `message` (string, optional)
- `remainingTokens` (integer, optional)
- `requestedTokens` (integer, optional)
- `expiresAt` (datetime, optional)
- `activeJobId` (string, optional)
- `upgradeUrl` (string, optional)
- `retryAfterSeconds` (integer, optional)

## Examples

**Request**

```json
{
  "contentType": "image/png"
}
```

**Response**

```json
{
  "uploadUrl": "string",
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890.png",
  "bucket": "string",
  "expiresIn": 1
}
```

**SDK Code**

```python
import requests

url = "https://api.segmentationapi.com/v1/uploads/presign"

payload = { "contentType": "image/png" }
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.segmentationapi.com/v1/uploads/presign';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"contentType":"image/png"}'
};

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.segmentationapi.com/v1/uploads/presign"

	payload := strings.NewReader("{\n  \"contentType\": \"image/png\"\n}")

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

	req.Header.Add("Authorization", "<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.segmentationapi.com/v1/uploads/presign")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"contentType\": \"image/png\"\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.segmentationapi.com/v1/uploads/presign")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"contentType\": \"image/png\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.segmentationapi.com/v1/uploads/presign', [
  'body' => '{
  "contentType": "image/png"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.segmentationapi.com/v1/uploads/presign");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"contentType\": \"image/png\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["contentType": "image/png"] as [String : Any]

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

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