GET /

Overview

The E-Paper API provides programmatic access to e-editions of newspapers. Retrieve available editions by date, then fetch page images, PDFs, or tile data for any edition.

Base URL

https://api.tradingref.com/epapers

Available Endpoints

MethodEndpointDescription
GET /editions/{date} List all languages, newspapers, and editions available for a given date
GET /getPage/{date}/{language}/{newspaper}/{edition} Get page URLs and type for a specific newspaper edition

Response Format

All endpoints return JSON responses with Content-Type: application/json. Successful responses use HTTP 200 status codes. Errors include a JSON body with an error field describing the issue.

Authentication

The Get Pages endpoint requires API credentials passed via request headers. The Get Editions endpoint is publicly accessible.

Required Headers

HeaderRequiredDescription
CF-Access-Client-Id Yes Your API client ID. This identifies your application.
CF-Access-Client-Secret Yes Your API client secret. Keep this secure and never expose it in client-side code.

Example Request

GET /epapers/getPage/20260906/gujarati/Gujarat%20Samachar/Ahmedabad HTTP/1.1
Host: api.tradingref.com
CF-Access-Client-Id: your-client-id
CF-Access-Client-Secret: your-client-secret

cURL Example

curl -X GET \
  "https://api.tradingref.com/epapers/getPage/20260906/gujarati/Gujarat%20Samachar/Ahmedabad" \
  -H "CF-Access-Client-Id: your-client-id" \
  -H "CF-Access-Client-Secret: your-client-secret"
Security Notice

Never expose your client secret in frontend code, browser requests, or public repositories. All API calls with credentials should be made from a secure backend server.

Error Response

If credentials are missing or invalid, the API returns a 403 Forbidden status:

{
  "error": "Invalid or missing credentials"
}

Workflow

Follow these steps to integrate the E-Paper API into your application.

Fetch Available Editions

Call the Get Editions endpoint with the desired date. This returns a list of all available languages, newspapers, and their edition names. Use this to populate your UI or determine what content is available.

GET /epapers/editions/20260906

Select Language, Newspaper & Edition

From the response, let the user choose or programmatically select the language, newspaper, and edition they want to view. These values become the path parameters for the next request.

Fetch Page URLs

Call the Get Pages endpoint with the selected parameters. The response includes the type of content and a pages array containing URLs or data for each page.

GET /epapers/getPage/20260906/gujarati/Gujarat%20Samachar/Ahmedabad

Handle the Response Based on Type

Use the returned type field to determine how to process the pages. For image types, display directly. For pdf or pdfl, use a PDF viewer. For tiles, fetch and stitch tile images. See Page Types for full details.

Get Editions

Retrieve all languages, newspapers, and edition names available for a specific date. This endpoint requires no authentication.

Frequently Updated Data

The editions data is updated throughout the day as different newspapers become available. Each publication has its own update schedule, so not all newspapers are available at the same time. New editions appear in the response as soon as they are published. Poll this endpoint periodically to get the latest availability.

Request

GET /epapers/editions/{date}

Path Parameters

ParameterTypeRequiredDescription
date string Yes The date to query, in YYYYMMDD format. Must be a valid date with available content.

Response

Returns a nested JSON object. The first level is keyed by language code, the second by newspaper name, and the value is an array of edition names.

Example Response 200 OK

{
  "gujarati": {
    "Gujarat Samachar": ["Ahmedabad", "Rajkot", "Mumbai", "Surat"],
    "Divya Bhaskar": ["Main Edition", "Saurashtra"]
  },
  "hindi": {
    "Dainik Bhaskar": ["Delhi", "Mumbai", "Jaipur"],
    "Dainik Jagran": ["Lucknow", "Kanpur"]
  },
  "english": {
    "Times of India": ["Ahmedabad", "Mumbai"],
    "Hindustan Times": ["Delhi"]
  }
}

Example Requests

# cURL
curl "https://api.tradingref.com/epapers/editions/20260906"

# JavaScript
const res = await fetch("https://api.tradingref.com/epapers/editions/20260906");
const editions = await res.json();

# Python
import requests
r = requests.get("https://api.tradingref.com/epapers/editions/20260906")
editions = r.json()

Get Pages

Fetch page URLs and content type for a specific newspaper edition. Requires API authentication.

Request

GET /epapers/getPage/{date}/{language}/{newspaper}/{edition}

Path Parameters

ParameterTypeRequiredDescription
date string Yes Date in YYYYMMDD format
language string Yes Language key from the editions response (e.g. gujarati, hindi, english)
newspaper string Yes Newspaper name exactly as returned by the editions endpoint. URL-encode spaces (e.g. Gujarat%20Samachar)
edition string Yes Edition name exactly as returned by the editions endpoint (e.g. Ahmedabad)

Response

Returns a JSON object with two fields:

FieldTypeDescription
type string The content type of the pages. Determines how URLs should be used. See Page Types for details.
pages array Array of URLs (or data objects) for each page in the edition.

Example Response 200 OK

{
  "type": "image",
  "pages": [
    "https://epaperstatic.gujaratsamachar.com/epaper/20260906-abc123-0.jpg",
    "https://epaperstatic.gujaratsamachar.com/epaper/20260906-abc123-1.jpg",
    "https://epaperstatic.gujaratsamachar.com/epaper/20260906-abc123-2.jpg",
    "https://epaperstatic.gujaratsamachar.com/epaper/20260906-abc123-3.jpg"
  ]
}

Error Responses

StatusConditionMessage
400 Missing parameters Missing required parameters: date, language, newspaper, edition
403 Invalid credentials Invalid or missing credentials
404 Date or edition not found No data found for this date or Edition not found
405 Non-GET request Method not allowed

Page Types

The type field in the Get Pages response determines how the URLs in the pages array should be interpreted and used.

image

Each URL points to a JPG image of a single page. You can display these directly in an <img> tag, embed them in a canvas, or use a library to compile them into a PDF document.

pdf

Each URL returns a standard, non-encrypted PDF file representing a single page. You can open these directly in a PDF viewer or combine them into a single document using a PDF library.

pdfl

Each URL returns an encrypted PDF file. The decryption password for each page is provided in the X-Session response header when you fetch that URL. You must read this header and pass the password to your PDF viewer to decrypt the page.

pdfc

A pre-built, fully combined PDF of the entire edition. The pages array contains a single URL pointing to the complete merged document. No assembly required.

tiles

Each URL returns a JSON object describing an image divided into a grid of tiles. Fetch the JSON, then download and stitch the tile images together to reconstruct the full page. Useful for progressive loading of high-resolution pages.

Using Encrypted PDFs (pdfl)

When fetching a page URL with type pdfl, the server includes an X-Session header in the response. This header contains the password needed to decrypt the PDF.

// Example: Fetching an encrypted PDF page
const response = await fetch(pageUrl, {
  headers: {
    "CF-Access-Client-Id": "your-client-id",
    "CF-Access-Client-Secret": "your-client-secret"
  }
});

// Extract the decryption password from the response header
const password = response.headers.get("X-Session");

// Get the encrypted PDF data
const pdfBlob = await response.blob();

// Use the password to decrypt and display the PDF
// (implementation depends on your PDF library)
Important

The X-Session password is per-page. Each page URL may return a different password. Always read the header from each individual page response.

Tiles Format

When the page type is tiles, each URL in the pages array returns a JSON object describing how the page image is split into a grid of smaller tiles.

Response Structure

FieldTypeDescription
width number Total width of the full page image in pixels
height number Total height of the full page image in pixels
cols number Number of tile columns in the grid
rows number Number of tile rows in the grid
chunks array Array of tile objects, each with position, dimensions, and URL

Chunk Object

FieldTypeDescription
tx number Horizontal position (x-offset) of this tile in pixels from the left edge
ty number Vertical position (y-offset) of this tile in pixels from the top edge
width number Width of this tile in pixels
height number Height of this tile in pixels
url string Direct URL to the tile image (JPG or PNG)

Example Response

{
  "width": 1600,
  "height": 2378,
  "cols": 2,
  "rows": 2,
  "chunks": [
    {
      "tx": 0, "ty": 0,
      "width": 800, "height": 1189,
      "url": "https://cache.epapr.in/4200698/.../1x1.jpg"
    },
    {
      "tx": 0, "ty": 1189,
      "width": 800, "height": 1189,
      "url": "https://cache.epapr.in/4200698/.../1x2.jpg"
    },
    {
      "tx": 800, "ty": 0,
      "width": 800, "height": 1189,
      "url": "https://cache.epapr.in/4200698/.../2x1.jpg"
    },
    {
      "tx": 800, "ty": 1189,
      "width": 800, "height": 1189,
      "url": "https://cache.epapr.in/4200698/.../2x2.jpg"
    }
  ]
}

Stitching Tiles Together

To reconstruct the full page image, create a canvas with the dimensions width x height, then draw each tile at its tx, ty position.

// JavaScript example using Canvas
async function stitchTiles(tileData) {
  const canvas = document.createElement("canvas");
  canvas.width = tileData.width;
  canvas.height = tileData.height;
  const ctx = canvas.getContext("2d");

  for (const chunk of tileData.chunks) {
    const img = await loadImage(chunk.url);
    ctx.drawImage(img, chunk.tx, chunk.ty, chunk.width, chunk.height);
  }

  return canvas;
}

function loadImage(url) {
  return new Promise((resolve) => {
    const img = new Image();
    img.crossOrigin = "anonymous";
    img.onload = () => resolve(img);
    img.src = url;
  });
}
Benefits of Tiles

Tiles enable progressive loading — you can display low-resolution placeholders while loading full-resolution tiles on demand. This is ideal for mobile apps and slow network conditions.

Errors

The API uses standard HTTP status codes to indicate success or failure. Error responses include a JSON body with details.

Error Response Format

{
  "error": "Description of what went wrong"
}

HTTP Status Codes

CodeMeaningCause
200 OK Request succeeded. Response body contains the requested data.
400 Bad Request Missing or malformed path parameters.
403 Forbidden Missing or invalid API credentials on the Get Pages endpoint.
404 Not Found No data exists for the given date, or the specified newspaper/edition was not found.
405 Method Not Allowed The request used a method other than GET.
500 Internal Server Error An unexpected error occurred on the server. Retry the request after a short delay.

Handling Errors

// JavaScript error handling example
async function fetchEditions(date) {
  const res = await fetch(`https://api.tradingref.com/epapers/editions/${date}`);

  if (!res.ok) {
    const error = await res.json();
    throw new Error(error.error || `HTTP ${res.status}`);
  }

  return res.json();
}