Logo

API Documentation

Getting Started

SnapOG provides a simple API to generate Open Graph images for your web pages. To get started, you'll need an API key which you can obtain from your dashboard after signing up.

Base URL

All API requests should be made to:

Base URL
1https://snapog.com

Authentication

All API requests require an API key which should be included in the URL path.

Authentication
1/api/{apiKey}?url=your-url

Endpoints

Generate an Open Graph image for a specific URL.

HTTP Request

HTTP Request
1GET /api/{apiKey}

Parameters

ParameterTypeRequiredDescription
urlQuery ParameterYesThe URL to generate an OG image for

Example Request

Example Request
1curl -X GET "https://snapog.com/api/{apiKey}?url=example.com/page" -H "Accept: image/png"

Example Usage in HTML

index.html
1<!-- Put in your <head> tag --> 2<meta 3 property="og:image" 4 content="https://snapog.com/api/{apiKey}?url=yourwebsite.com" 5/>

Response

The API returns a PNG image if successful. In case of an error, it returns a JSON response with an error message.

Legacy Endpoint

For backward compatibility, the old endpoint /api/get is still supported but we recommend using the new endpoint for new integrations.

Best Practices

  • Always URL encode the url parameter to ensure proper handling
  • Consider caching the generated images on your end for better performance

Error Codes

Status CodeDescription
400

Missing URL or API key

||

Insufficient credits

401

Invalid API key

404

Invalid URL

||

Domain not found

500

Internal server error