API Reference
Get up and running with our API methods, keys and integration tools.
Get Started
The base URL for our API is
https://api.screpto.com/v1
All requests must be encoded as JSON
with the Content-Type: application/json
header.
Responses from Screpto API, including errors, are encoded as JSON as well.
Authentication
Requests to the API must provide an API key through the Authorization header which can be found in Account settings
→ API Key tab
.
https://api.screpto.com/v1?token=<API_KEY>
Replace
<API_KEY>
with your account's API key
Errors
All API endpoints contain a status code, error type and a message within the error responses.
{"statusCode": 400,"error": "Bad Request","message": "Missing token query param"}
Rate Limits
We limit the number of calls you can make over a certain period of time. Rate limits vary and are specified by the following header in all responses:
Header | Description |
---|---|
x-ratelimit-limit | The maximum number of requests that the consumer is permitted to make. |
x-ratelimit-remaining | The number of requests remaining in the current rate limit window. |
x-ratelimit-reset | The time at which the current rate limit window resets in UTC epoch seconds. |
When the rate limit is exceeded, an error is returned with the status "429 Too Many Requests":
{"error": {"code": "too_many_requests","message": "Rate limit exceeded",}}
Results
Get task results
Endpoint:
GET https://api.screpto.com/v1/results/:TASK_ID
Retrieves results of a task.
Example Request:
curl "https://api.screpto.com/v1/results/:task_id?token=<API_KEY>"
Request parameters
Name | Type | Required | Description |
---|---|---|---|
token | String | Yes | Your account API key |
resultId | ID | No | A string ID of a run. When defined, this parameter allows you to retrieve results of a specific run instead of default. |
download | String | No | The format in which you want to download the results which can either be json or csv . |
Webhooks
Webhooks allow you to subscribe to certain events on your task by providing a destination URL.
We send a POST request to that URL with an event payload every time an event associated with the webhook happens.
Each task can register up to 2 webhooks.
Webhook events
The webhook URL receives a HTTP POST request with a JSON payload for each event. All the events has the following format:
{"type": <event-type>,"createdAt": <javascript-timestamp>,"payload": <payload for the event>,"taskId": <taskId>}
Event Payloads
Here's a list of supported event types and their payload.
Successful run
run.success
Event type: Occurs whenever a task run is successfuly completed.
Key | Type | Description |
---|---|---|
resultId | ID | Run identifier |
duration | Number | Execution duration in seconds |
totalPages | Number | Total numbers of pages extracted |
data | Array | Extraction results in JSON format |
Failed run
run.failure
Event type: Occurs whenever a task run fails.
Key | Type | Description |
---|---|---|
reason | String | Reason of failure |
Cost calculation
At its core, Screpto manages a large pool of servers with a strong platform on top and then lends this platform to users. If you run a task, you get allocated a part of our servers with the added services that we provide. This allocated server does some work for you and after everything is done, the server is returned to our pool.
This means credit consumption is directly correlated to the specifics of your request.
Execution cost
Credit consumption per successful Execution
Description | Credits consumed |
---|---|
1 second execution duration | 10 |
1 second execution duration with Javascript rendering enabled | 20 |
API request cost
Credit consumption per successful API request
Description | Credits consumed |
---|---|
1 API request | 20 |
1 webhook HTTP request | 20 |