Export
One of the most common patterns when integrating with our services is to submit a scan and download the full results as soon as the scan is completed. When the scan is completed, Copyleaks triggers a ‘Completed’ webhook to inform that the scan has been completed. At this point, you will have all the needed information (i.e. the ‘result ids’) to download and present the reports on your side. Since you may have a large number of documents to download (the results, crawled version of the text and the pdf-report), you may need to send many HTTP REST calls to execute to export the data from our services.
The ‘Export’ method makes this process easier by specifying the content you would like to export in a single call, and we will copy all the data according to your request. Then, we will fire an ‘export-completed’ webhook with the export results summary.
If you are using a distributed cloud storage system (like AWS buckets, Google buckets or Azure Storage), we can export the data directly to your storage without the involvement of your servers. To do so, create a Signed URL for each data item that you would like to export. By specifying the request method (verb) and optionally added headers, the writing to this storage will be triggered, as per your definition.
Request
Section titled “Request”Path Parameters
Section titled “Path Parameters”A new Id for the export process.
>= 3 characters
<= 36 characters
Match pattern: [a-z0-9] !@$^&-+%=_(){}<>';:/.",~
|`
The scan ID of the specific scan to export. learn more about the criteria for creating a Scan ID.
>= 3 characters
<= 36 characters
Match pattern: [a-z0-9] !@$^&-+%=_(){}<>';:/.",~
|`
Headers
Section titled “Headers”Content-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN
Request Body
Section titled “Request Body”The request body is a JSON object containing the export configuration.
This webhook event is triggered once the export is completed.
Adds headers to the webhook.
Example: [ [ "header-key", "header-value" ], ... ]
How many retries to send before giving up. Using high value (12) may lead to a longer time until the completionWebhook being executed. A low value (1) may lead to errors while your service is temporary having problems.
>= 1
<= 12
Add a custom developer payload that will then be provided on the Export-Completed webhook.
results array[object]
An array of results to be exported. Learn more about Result Webhook.
<= 1000 items
Result identification to be downloaded. You get these identifications from the completed webhook.
The HTTP url to upload the data.
The HTTP verb (also called “HTTP Methods”) to upload the data to your specified endpoint.
Example: POST
(Jagged Array)
List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as “Authorization” header.
pdfReport object
Download the PDF report. Allowed only when properties.pdf.create
was set to true
on the scan submission.
The HTTP url to upload the data.
The HTTP verb (also called “HTTP Methods”) to upload the data to your specified endpoint.
Example: POST
(Jagged Array)
List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as “Authorization” header.
aiDetection object
Export the AI Content detection report. Allowed only when properties.aiGeneratedText.detect
was set to true
on the scan submission. Learn more about AI Content Detection Webhook.
The HTTP url to upload the data.
The HTTP verb (also called “HTTP Methods”) to upload the data to your specified endpoint.
Example: POST
(Jagged Array)
List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as “Authorization” header.
writingFeedback object
Export the Writing Assistant report. Allowed only when properties.writingFeedback.enable
was set to true
on the scan submission. Learn more about Writing Assistant Webhook.
The HTTP url to upload the data.
The HTTP verb (also called “HTTP Methods”) to upload the data to your specified endpoint.
Example: POST
(Jagged Array)
List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as “Authorization” header.
overview object
Export the Overview report. Allowed only when properties.overview.enable
was set to true
on the scan submission. Learn more about Overview Webhook.
The HTTP url to upload the data.
The HTTP verb (also called “HTTP Methods”) to upload the data to your specified endpoint.
Example: POST
(Jagged Array)
List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as “Authorization” header.
crawledVersion object
Download the crawled version of the submitted text. Learn more about Crawled-Version Webhook.
The HTTP url to upload the data.
The HTTP verb (also called “HTTP Methods”) to upload the data to your specified endpoint.
Example: POST
(Jagged Array)
List of headers to be submitted with the upload request. You may use this field to provide additional request headers, such as “Authorization” header.
Responses
Section titled “Responses”The command was executed. The export started.
Bad request. One or more details in your request is wrong.
Example Response
A typical response from this endpoint:
Scan wasn't finished yet.
Authorization has been denied for this request.
Example Response
A typical response from this endpoint:
{ "type": "https://tools.ietf.org/html/rfc9110#section-15.5.2", "title": "Unauthorized", "status": 401, "traceId": "00-ef0db7690ced98431ac97782051edc77-2c4194d74ae6c08b-00"}
The scan id that was specified doesn't exist.
Conflict. An export task with the same Id already exists in the system.
Example Response
A typical response from this endpoint:
{ "type": "https://tools.ietf.org/html/rfc9110#section-15.5.10", "title": "Conflict", "status": 409, "traceId": "00-561fe3b2451eb51ce489557a2f34f247-3acd41c0b4ad1295-00"}
Examples
Section titled “Examples”POST https://api.copyleaks.com/v3/downloads/my-scan-123/export/my-export-1Content-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN
{ "results": [ { "id": "my-result-id", "verb": "POST", "headers": [ [ "header-key", "header-value" ] ], "endpoint": "https://yourserver.com/export/export-id/results/my-result-id" } ], "pdfReport": { "verb": "POST", "headers": [ [ "header-key", "header-value" ] ], "endpoint": "https://yourserver.com/export/export-id/pdf-report" } ], "crawledVersion": { "verb": "POST", "headers": [ [ "header-key", "header-value" ] ], "endpoint": "https://yourserver.com/export/export-id/crawled-version" }, "completionWebhook": "https://yourserver.com/export/export-id/completed", "maxRetries": 3}
curl --request POST \ --url https://api.copyleaks.com/v3/downloads/my-scan-123/export/my-export-1 \ --header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "results": [ { "id": "my-result-id", "verb": "POST", "headers": [ [ "header-key", "header-value" ] ], "endpoint": "https://yourserver.com/export/export-id/results/my-result-id" } ], "pdfReport": { "verb": "POST", "headers": [ [ "header-key", "header-value" ] ], "endpoint": "https://yourserver.com/export/export-id/pdf-report" }, "crawledVersion": { "verb": "POST", "headers": [ [ "header-key", "header-value" ] ], "endpoint": "https://yourserver.com/export/export-id/crawled-version" }, "completionWebhook": "https://yourserver.com/export/export-id/completed", "maxRetries": 3 }'