Skip to content

Screenshot API

Create Screenshot Job

Trigger an asynchronous task to capture a screenshot of a given URL.

  • Method: POST
  • Path: /v1/screenshot

Headers

  • Content-Type: application/json

Body

json
{
  "url": "https://example.com",
  "full_page": false,
  "width": 1920,
  "height": 1080,
  "extra_wait": 0,
  "scroll_wait": 0.2,
  "element": ".my-class"
}

Response (200 OK)

json
{
  "message": "Screenshot job successfully created",
  "jobId": "run_12345"
}

Example Request (cURL)

bash
curl -X POST https://api.perlica.my.id/v1/screenshot \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "full_page": false,
    "width": 1920,
    "height": 1080
  }'

Example Request (JavaScript / Fetch)

javascript
async function createScreenshotJob() {
  const response = await fetch("https://api.perlica.my.id/v1/screenshot", {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      url: "https://example.com",
      full_page: false,
      width: 1920,
      height: 1080
    })
  });

  const data = await response.json();
  console.log(data);
}

createScreenshotJob();

Get Screenshot Job Status

Retrieve the status and result of a screenshot job.

  • Method: GET
  • Path: /v1/screenshot/:jobId

Response (200 OK)

Pending or Running:

json
{
  "jobId": "run_12345",
  "status": "QUEUED"
}

Completed:

json
{
  "jobId": "run_12345",
  "status": "COMPLETED",
  "result": "..."
}

Failed:

json
{
  "jobId": "run_12345",
  "status": "FAILED",
  "error": "..."
}

Example Request (cURL)

bash
curl -X GET https://api.perlica.my.id/v1/screenshot/run_12345

Example Request (JavaScript / Fetch)

javascript
async function getJobStatus(jobId) {
  const response = await fetch(`https://api.perlica.my.id/v1/screenshot/${jobId}`);
  const data = await response.json();
  console.log(data);
}

getJobStatus("run_12345");