Quick Start

Get up and running with the WebPeek API in just a few minutes.

1. Make Your First Request

All endpoints require API key authentication. Include your API key in the X-API-Key header:

curl "https://api.webpeek.dev/metadata?url=https://github.com" \
  -H "X-API-Key: YOUR_API_KEY"

2. Parse the Response

The metadata endpoint returns structured JSON with comprehensive information:

{
  "url": "https://github.com",
  "final_url": "https://github.com",
  "fetched_at": "2025-01-06T12:00:00.000Z",
  "title": "GitHub: Let's build from here",
  "description": "GitHub is where over 100 million developers...",
  "language": "en",
  "canonical": {
    "href": "https://github.com",
    "is_self_canonical": true,
    "resolves": true,
    "status": 200
  },
  "og": {
    "title": "GitHub",
    "image": "https://github.githubassets.com/images/og.png",
    "description": "GitHub is where over 100 million developers..."
  },
  "twitter": {
    "card": "summary_large_image",
    "site": "github"
  },
  "icons": [
    {
      "rel": "icon",
      "sizes": "32x32",
      "type": "image/png",
      "url": "https://github.githubassets.com/favicon.png"
    }
  ]
}

3. Integrate Into Your App

Here's how to use the API in JavaScript:

app.js
async function getMetadata(url) {
  const response = await fetch(
    `https://api.webpeek.dev/metadata?url=${encodeURIComponent(url)}`,
    {
      headers: {
        'X-API-Key': 'YOUR_API_KEY'
      }
    }
  );

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.message);
  }

  return await response.json();
}

// Example usage
const metadata = await getMetadata('https://github.com');
console.log(metadata.title); // "GitHub: Let's build from here"
console.log(metadata.og.image); // "https://github.githubassets.com/images/og.png"
console.log(metadata.canonical.href); // "https://github.com"

Available Endpoints

WebPeek offers four main endpoints:

Next Steps