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

# Export Sync Logs

POST https://app.polytomic.com/api/bulk/syncs/{sync_id}/executions/{execution_id}/logs/export

Starts an asynchronous job that packages the log files for a single bulk sync execution into a downloadable archive.

> 📘 Log export is asynchronous
>
> This endpoint starts a background job that packages an execution's log
> files into a downloadable archive. The first call typically returns a
> `job` descriptor instead of a completed result. Poll
> [`GET /api/jobs/exportlogs/{id}`](../../../../../../../../api-reference/jobs/get)
> with the returned `job_id` until `status` is `done`; the final response
> contains a signed `url` that can be used to download the archive.
>
> Set `notify=true` to also email the requesting user when the archive is
> ready.

Reference: https://apidocs.polytomic.com/2024-02-08/api-reference/bulk-sync/executions/export-logs

## Authentication

- `Authorization` header (basic auth, required) — This is the Polytomic deployment key (on-premises only)
- `Authorization` header (bearer token, required) — This is the Polytomic API key

## Request

### Path parameters

- `sync_id` (string, required) — Unique identifier of the bulk sync.
- `execution_id` (string, required) — Unique identifier of the execution whose logs should be exported.

### Query parameters

- `notify` (boolean, optional) — Send a notification to the user when the logs are ready for download.

## Response

### 200

OK

- `data` (V4ExportSyncLogsResponse, optional)
- `job` (V2JobResponse, optional)

## Errors

### 400 Bad Request Error

Bad Request

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 401 Unauthorized Error

Unauthorized

- `code` (integer, optional) — Application-specific error code.
- `context` (map from string to any, optional) — Application context.
- `error` (string, optional) — Error message.
- `status` (string, optional) — Status text.

### 404 Not Found Error

Not Found

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 500 Internal Server Error

Internal Server Error

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

## Types

### V4ExportSyncLogsResponse

- `url` (string, optional) — Signed URL to download the exported log archive.

### V2JobResponse

- `error` (string, optional, nullable) — Error message if the job failed.
- `job_id` (string, optional) — Identifier of the job.
- `result` (any, optional) — Job result. Shape depends on the job type; only populated once status is done.
- `status` (enum, optional)
  - Allowed values: `created`, `running`, `done`, `failed`
- `type` (string, optional) — Job type. Matches the type used to fetch the job.

## Examples

**Response**

```json
{
  "data": {
    "url": "string"
  },
  "job": {
    "error": "error message",
    "job_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "result": null,
    "status": "created",
    "type": "createmodel"
  }
}
```

**SDK Code**

```typescript
import { PolytomicClient } from "polytomic";

async function main() {
    const client = new PolytomicClient({
        token: "YOUR_TOKEN_HERE",
        version: "X-Polytomic-Version",
    });
    await client.bulkSync.executions.exportLogs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", {});
}
main();

```

```python
from polytomic import Polytomic

client = Polytomic(
    token="YOUR_TOKEN_HERE",
    version="X-Polytomic-Version",
)

client.bulk_sync.executions.export_logs(
    sync_id="248df4b7-aa70-47b8-a036-33ac447e668d",
    execution_id="248df4b7-aa70-47b8-a036-33ac447e668d",
)

```

```go
package example

import (
    context "context"

    bulksync "github.com/polytomic/polytomic-go/v24/bulksync"
    client "github.com/polytomic/polytomic-go/v24/client"
    option "github.com/polytomic/polytomic-go/v24/option"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "YOUR_TOKEN_HERE",
        ),
        option.WithVersion(
            "X-Polytomic-Version",
        ),
    )
    request := &bulksync.ExecutionsExportLogsRequest{}
    client.BulkSync.Executions.ExportLogs(
        context.TODO(),
        "248df4b7-aa70-47b8-a036-33ac447e668d",
        "248df4b7-aa70-47b8-a036-33ac447e668d",
        request,
    )
}

```

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

url = URI("https://app.polytomic.com/api/bulk/syncs/248df4b7-aa70-47b8-a036-33ac447e668d/executions/248df4b7-aa70-47b8-a036-33ac447e668d/logs/export")

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

request = Net::HTTP::Post.new(url)
request["X-Polytomic-Version"] = 'X-Polytomic-Version'
request.basic_auth("<username>", "<password>")

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.polytomic.com/api/bulk/syncs/248df4b7-aa70-47b8-a036-33ac447e668d/executions/248df4b7-aa70-47b8-a036-33ac447e668d/logs/export")
  .header("X-Polytomic-Version", "X-Polytomic-Version")
  .basicAuth("<username>", "<password>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.polytomic.com/api/bulk/syncs/248df4b7-aa70-47b8-a036-33ac447e668d/executions/248df4b7-aa70-47b8-a036-33ac447e668d/logs/export', [
  'headers' => [
    'X-Polytomic-Version' => 'X-Polytomic-Version',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://app.polytomic.com/api/bulk/syncs/248df4b7-aa70-47b8-a036-33ac447e668d/executions/248df4b7-aa70-47b8-a036-33ac447e668d/logs/export");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Polytomic-Version", "X-Polytomic-Version");

IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "X-Polytomic-Version": "X-Polytomic-Version",
  "Authorization": "Basic \(credentials)"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/bulk/syncs/248df4b7-aa70-47b8-a036-33ac447e668d/executions/248df4b7-aa70-47b8-a036-33ac447e668d/logs/export")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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