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

# Collect Job Outputs

POST /api/v1/jobs/{job_id}/collect
Content-Type: application/json

Collect the job outputs into the destination bucket that was set up during onboarding. The job status must be `completed`.
Provide `jobId` as path parameter and provide credentials in the request body. The output files will be saved using the `output_prefix` provided, appended with the `jobId`.

Reference: https://docs.emtelligent.com/extract/api/collect-job-api-v-1-jobs-job-id-collect-post

## Request

### Path parameters

- `job_id` (string, required)

### Headers

- `X-API-Key` (string, optional, nullable) — API key for authentication

### Body (application/json)

This endpoint expects a CollectJobRequest.

- `user_credentials` (UserCredentials, required)
- `output_prefix` (string, required) — S3 prefix
- `aws_region` (string, required) — AWS region

## Response

### 200

Successful Response

- `any`

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### UserCredentials

- `aws_access_key_id` (string, required) — AWS access key ID
- `aws_secret_access_key` (string, required) — AWS secret access key
- `session_token` (string, optional, nullable) — AWS session token
- `expiry` (string, optional, nullable) — ISO 8601 UTC timestamp for when credentials expire

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

### collect_job_api_v1_jobs__job_id__collect_post_example

**Response**

```json
{
  "job_id": "{jobId}",
  "job_name": "name",
  "job_status": "transferring"
}
```

**SDK Code**

```python collect_job_api_v1_jobs__job_id__collect_post_example
import requests

url = "https://api.example.com/api/v1/jobs/job_id/collect"

response = requests.post(url)

print(response.json())
```

```javascript collect_job_api_v1_jobs__job_id__collect_post_example
const url = 'https://api.example.com/api/v1/jobs/job_id/collect';
const options = {method: 'POST'};

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

```go collect_job_api_v1_jobs__job_id__collect_post_example
package main

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

func main() {

	url := "https://api.example.com/api/v1/jobs/job_id/collect"

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

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

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

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

}
```

```ruby collect_job_api_v1_jobs__job_id__collect_post_example
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/jobs/job_id/collect")

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

request = Net::HTTP::Post.new(url)

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

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

HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/jobs/job_id/collect")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/api/v1/jobs/job_id/collect');

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

```csharp collect_job_api_v1_jobs__job_id__collect_post_example
using RestSharp;

var client = new RestClient("https://api.example.com/api/v1/jobs/job_id/collect");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift collect_job_api_v1_jobs__job_id__collect_post_example
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/api/v1/jobs/job_id/collect")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

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()
```

### Example 1

**Request**

```json
{
  "user_credentials": {
    "aws_access_key_id": "key",
    "aws_secret_access_key": "secret",
    "session_token": "token",
    "expiry": "2025-08-01T20:15:30Z"
  },
  "output_prefix": "s3_prefix/to/output/",
  "aws_region": "region"
}
```

**Response**

```json
{
  "job_id": "{jobId}",
  "job_name": "name",
  "job_status": "transferring"
}
```

**SDK Code**

```python Example 1
import requests

url = "https://api.example.com/api/v1/jobs/job_id/collect"

payload = {
    "user_credentials": {
        "aws_access_key_id": "key",
        "aws_secret_access_key": "secret",
        "session_token": "token",
        "expiry": "2025-08-01T20:15:30Z"
    },
    "output_prefix": "s3_prefix/to/output/",
    "aws_region": "region"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Example 1
const url = 'https://api.example.com/api/v1/jobs/job_id/collect';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"user_credentials":{"aws_access_key_id":"key","aws_secret_access_key":"secret","session_token":"token","expiry":"2025-08-01T20:15:30Z"},"output_prefix":"s3_prefix/to/output/","aws_region":"region"}'
};

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

```go Example 1
package main

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

func main() {

	url := "https://api.example.com/api/v1/jobs/job_id/collect"

	payload := strings.NewReader("{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\",\n    \"session_token\": \"token\",\n    \"expiry\": \"2025-08-01T20:15:30Z\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}")

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

	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 Example 1
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/jobs/job_id/collect")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\",\n    \"session_token\": \"token\",\n    \"expiry\": \"2025-08-01T20:15:30Z\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/jobs/job_id/collect")
  .header("Content-Type", "application/json")
  .body("{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\",\n    \"session_token\": \"token\",\n    \"expiry\": \"2025-08-01T20:15:30Z\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/api/v1/jobs/job_id/collect', [
  'body' => '{
  "user_credentials": {
    "aws_access_key_id": "key",
    "aws_secret_access_key": "secret",
    "session_token": "token",
    "expiry": "2025-08-01T20:15:30Z"
  },
  "output_prefix": "s3_prefix/to/output/",
  "aws_region": "region"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Example 1
using RestSharp;

var client = new RestClient("https://api.example.com/api/v1/jobs/job_id/collect");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\",\n    \"session_token\": \"token\",\n    \"expiry\": \"2025-08-01T20:15:30Z\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Example 1
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "user_credentials": [
    "aws_access_key_id": "key",
    "aws_secret_access_key": "secret",
    "session_token": "token",
    "expiry": "2025-08-01T20:15:30Z"
  ],
  "output_prefix": "s3_prefix/to/output/",
  "aws_region": "region"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/api/v1/jobs/job_id/collect")! 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()
```

### Example 2

**Request**

```json
{
  "user_credentials": {
    "aws_access_key_id": "key",
    "aws_secret_access_key": "secret"
  },
  "output_prefix": "s3_prefix/to/output/",
  "aws_region": "region"
}
```

**Response**

```json
{
  "job_id": "{jobId}",
  "job_name": "name",
  "job_status": "transferring"
}
```

**SDK Code**

```python Example 2
import requests

url = "https://api.example.com/api/v1/jobs/job_id/collect"

payload = {
    "user_credentials": {
        "aws_access_key_id": "key",
        "aws_secret_access_key": "secret"
    },
    "output_prefix": "s3_prefix/to/output/",
    "aws_region": "region"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Example 2
const url = 'https://api.example.com/api/v1/jobs/job_id/collect';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"user_credentials":{"aws_access_key_id":"key","aws_secret_access_key":"secret"},"output_prefix":"s3_prefix/to/output/","aws_region":"region"}'
};

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

```go Example 2
package main

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

func main() {

	url := "https://api.example.com/api/v1/jobs/job_id/collect"

	payload := strings.NewReader("{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}")

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

	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 Example 2
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/jobs/job_id/collect")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/jobs/job_id/collect")
  .header("Content-Type", "application/json")
  .body("{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/api/v1/jobs/job_id/collect', [
  'body' => '{
  "user_credentials": {
    "aws_access_key_id": "key",
    "aws_secret_access_key": "secret"
  },
  "output_prefix": "s3_prefix/to/output/",
  "aws_region": "region"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Example 2
using RestSharp;

var client = new RestClient("https://api.example.com/api/v1/jobs/job_id/collect");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"user_credentials\": {\n    \"aws_access_key_id\": \"key\",\n    \"aws_secret_access_key\": \"secret\"\n  },\n  \"output_prefix\": \"s3_prefix/to/output/\",\n  \"aws_region\": \"region\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Example 2
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "user_credentials": [
    "aws_access_key_id": "key",
    "aws_secret_access_key": "secret"
  ],
  "output_prefix": "s3_prefix/to/output/",
  "aws_region": "region"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/api/v1/jobs/job_id/collect")! 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()
```