Skip to main content

Upload PDFs via API

Prerequisites for Using Smart UI

  • Familiarity with HTTP APIs is essential.
  • Visit the LambdaTest SmartUI page and log in with your credentials.
  • Obtain your LT_USERNAME and LT_ACCESS_KEY by clicking on the Access Key button, located at the top right corner of your dashboard.

Step 1: Establishing a SmartUI Project

To initiate a SmartUI PDF Comparison Project, adhere to the following instructions:

  1. Navigate to the SmartUI Projects Page.
  2. Tap on the new project button.
  3. Specify your platform type as PDF.
  4. Provide your project name, designate approvers, and add tags (optional).
  5. Confirm your entry by clicking on Submit.

Once your project is active, retrieve your Project Token from the application. Here's an example of a project token:

projectToken = "123456#1234abcd-****-****-****-************"

Uploading PDFs via API

After setting up your SmartUI Project, you can upload your local PDF files to your project. This will automatically generate a build by capturing snapshots of every page.

Here's how you can upload your PDFs:

  1. Retrieve your API URL Endpoint post activation of your enterprise plan. To schedule a demonstration, click here.

  2. Append the following parameters to your request payload via form-body:

VariableTypeDescriptionRequired?
projectTokenstringThis token is required to upload PDF files and validate your project.
Example: projectToken:123456#1234abcd-****-****-****-************
Yes
pathToFilesarrayAdd the path to the PDFs that will be uploaded.
Example: pathToFiles : [ "path/to/pdf-1", "path/to/pdf-2"]
Yes
buildNamestringAssign a name of your choice to the build comprising the uploaded PDFs.
Example: buildName : #<Build_Name>
No
note

Only files in .pdf format are compatible with this feature.

API Request Example

Here's a sample API request using cURL:

curl -X POST "YOUR_API_ENDPOINT" \
-H "Content-Type: multipart/form-data" \
-F "projectToken=123456#1234abcd-****-****-****-************" \
-F "pathToFiles[]=path/to/document1.pdf" \
-F "pathToFiles[]=path/to/document2.pdf" \
-F "buildName=Release-v2.1"

Response Format

The API will return a JSON response containing:

  • Build ID: Unique identifier for the uploaded build
  • Status: Upload status (success/failure)
  • Pages Captured: Number of pages processed
  • Test Results: Visual comparison results (if available)

Use Cases

  • Automated CI/CD Integration: Seamlessly integrate PDF testing into your deployment pipeline
  • Batch Processing: Upload multiple PDFs simultaneously for efficient testing
  • Custom Workflows: Build custom applications that interact with SmartUI programmatically
  • Enterprise Integration: Connect with existing enterprise systems and workflows

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles