Authentication to the Oh See Snaps API happens via a generated API token. All requests must include the API token otherwise they will return a 401
response. Read more on how to authenticate your requests under the Authenticating requests section.
You can generate a new API token from the API Tokens page:
There are two ways to authenticate your requests via your API token:
token
query paramAuthorization
headerHere's an example of each:
1# `token` query param:2curl https://ohseesnaps.com/api/snap?url=https://ohseesoftware.com \3 &token=XXXXX 4 5# `Authorizaton` header:6curl http://ohseesnaps.com/api/snap?url=https://ohseesoftware.com \7 -H "Authorization: Bearer XXXXX"
You can generate snaps via sending a request to the Oh See Snaps API. The most common approach is to set an HTML <img />
element's src
attribute to the snap URL, for example:
1<img2 src="https://ohseesnaps.com/api/snap \3 ?token=XXXXX \4 &url=https://ohseesoftware.com"5/>
Alternatively, you can send an API request via your client of choice (cURL, Guzzle, fetch, etc). The API will return a redirect to the image on our CDN.
The following query parameters can be used to customize each snap.
url
The URL of the website to take a snap of.
1# Set the URL of the website to snap2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com
w
The width (in pixels) of the viewport to use when creating the snap.
1# Set the width of the viewport.2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &w=1920
h
The height (in pixels) of the viewport to use when creating the snap.
1# Set the height of the viewport.2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &h=1080
f
The format of the generated snap file.
1# Generate a PDF file:2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &f=pdf
dpi
The device scale factor to use when loading the snap. Use this parameter to replica retina devices.
1# Print-sized image2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &dpi=3
q
The quality of the generated snap. The quality parameter is only referenced when generating a jpeg format snap.
1# 75% quality2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &f=jpeg7 &q=75
mobile
A boolean to indicate if the meta viewport
tag should be taken into account when snapping the requested URL.
1# Emulate mobile2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &mobile=true
fullPage
A boolean to indicate if the snap should be of the full page. If this is set to true
, the height parameter on the request is ignored.
1# Take a snap of the full page, ignoring height2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &fullPage=true
force
A boolean (or string representation of a boolean) to indicate if the cache should be skipped when generating the snap. If true
is passed, the cache will be skipped and a snap credit will be consumed.
1# Force a new snap to be generated2 3https://ohseesnaps.com/api/snap \4 ?token=XXXXX \5 &url=https://example.com6 &force=true