Introduction
The PDF API allows you to generate detailed and customizable PDF reports of scan results, including plagiarism checks, AI detection, and Grammar Checker feedback. These reports can be branded with your own logo and customized to match your organization’s needs. The PDF generation process is integrated with the Copyleaks scanning process, where you enable PDF creation during scan submission and then receive the generated PDF through webhooks. Copyleaks API also offers different PDF report versions, with version 3 being the latest and most feature-rich option that includes advanced formatting and comprehensive analysis visualization.PDF files for keeping records of individual scan results, which complement the interactive reports, are created through the download functionality in the report UI. If you have other PDF requirements to complement the interactive report options, please contact Copyleaks Support.
Before you begin
Before you start using the PDF API, ensure you have the following:- An active Copyleaks account: If you don’t have one, sign up here.
- Familiarity with RESTful API principles: Basic knowledge of HTTP requests and responses.
- A tool for HTTP requests: Use tools like cURL, Postman, or Copyleaks’ SDK.
Installations
Choose your preferred method for making API calls.HTTP needs no installation - call the API with any standard HTTP client, or import our Postman collection for a quicker start.
Login
To enable PDF report generation, we first need to generate an access token. We will use the login endpoint. The API key can be found on the Copyleaks API Dashboard. Upon successful authentication, you will receive a token that must be attached to subsequent API calls via the Authorization: Bearer<TOKEN> header.
This token remains valid for 48 hours.
Submit Scan with PDF Report Enabled
Use the submit file endpoint to send content for analysis while enabling PDF report generation. The key difference for PDF reports is including theproperties.pdf.create parameter set to true.
In the URL, supply your chosen scan ID, which serves as the identifier for the scan. Each scan needs to have a unique scan ID.
The properties.pdf.reportVersion should be set to “latest” to use the latest PDF report format with enhanced visuals and comprehensive data visualization.
The properties.pdf.title allows you to customize the title that appears on the PDF report.
The properties.displayLanguage allows you to generate the PDF report in a specific language.
For branding purposes, you can include your organization’s logo using properties.pdf.largeLogo (PNG format, base64 encoded, max 100kb, recommended size 185x50px).
There are more customization options available for PDF reports, but this guide doesn’t cover all of them.For this tutorial, we also pass in
properties.sandbox as TRUE to enable sandbox mode. The sandbox mode is free to use, but it returns mock results. Using sandbox mode while working on integrating with the Copyleaks API is helpful.PDF Customization Options
The PDF report can be extensively customized to match your organization’s branding and requirements.Wait For Scan Completion
The scan and PDF report generation may take seconds to minutes, depending on the content, features used, and products enabled. Once the scan is complete successfully, Copyleaks API will send a completed webhook to the URL you supplied in the submit underproperties.webhooks.status. At the same time, the {STATUS} is replaced with “completed”.
The completed webhooks hold the summary information about the scan, such as the number of matched words, total words, and results found.
If the scan finishes with an error, an error webhook will be sent to the properties.webhooks.status while the {STATUS} is replaced with error.
For testing purposes, we recommend using a third-party service such as request bin or ngrok.
Exporting PDF Reports
Use the export method to retrieve the generated PDF report along with other scan artifacts. The export method sends webhooks with each artifact’s content to your specified target server. We supply the Scan ID we used earlier in the submit endpoint in the URL. The user chooses a unique Export ID for each export. For PDF reports specifically, we add apdf section to the export request, providing an endpoint where the PDF should be sent when ready.
Next Steps
Webhooks Overview
Learn about webhooks in the Copyleaks API and how to handle real-time notifications.
Export Method
Understand the export method for retrieving various scan artifacts including PDF reports.
Authenticity API Overview
Learn about the comprehensive scanning API that supports multiple products and features.
Support
Should you require any assistance or have inquiries, please contact Copyleaks Support or ask a question on Stack Overflow with thecopyleaks-api tag.
