Skip to main content

API Workflow Endpoints

To easily manage and use the api workflows in your codebase, we provide some very simple api's which allows you to very easily do this.

To use any of these api's we will need to verify you, to verify you we use your api key. You can get your api key from the builder page after signing up our website.

Get all of your workflows

To get all of a user's workflows you will need to send a GET request to this api route along with your api key, if your api key is invalid then the api won't return your workflows and instead return an error. Here is an example request:

https://api.scrapeautomate.com/workflow/?apiKey=<exampleApiKey>

You should get a response like this:

[
{
"id": "cm3fecjrs0008s28cf14tavd9",
"userId": "cm3f9vz6k0000l5b2iemru05l",
"config": {
"url": "https://example.com/",
"apiKey": "96e2aecc-4767-426f-8276-2fcf540463c7",
"render": "false"
},
"name": "Hello",
"lastRun": null,
"creditsSpent": 0,
"createdAt": "2024-11-13T04:44:09.880Z",
"updatedAt": "2024-11-13T04:44:09.880Z",
"archived": false
}
// Additional data...
]

If your api key is invalid you will get an error like this:

{
"success": false,
"message": "User with that api key not found!"
}

Get the requests of a specific workflow

To get the requests made using a specific workflow you need to get the id of the workflow you want to get the requests of, to do this you can use the get all workflows api which will return you an id field for every single workflow.

Using the workflow id send an GET request to the following URL with your api key and workflow id like this:

https://api.scrapeautomate.com/workflow/requests/${requestId}/?apiKey=<exampleApiKey>

If everything is correct, In the response you should see an array of requests which were made using that workflow.

Creating an workflow using the api

Creating an api workflow using the api is very simple, to create a workflow send an POST request to following API:

https://api.scrapeautomate.com/workflow/create/?apiKey=<exampleApiKey>

In the body you have to send an JSON object which contains the following data:

{
"config": {}, // Scaper configuration
"name": "" // name of the workflow
}

The scraper configuration is the configuration that you send to the scraper api route (query parameters), if for some reason any of the required values are missing you will get an validation error like this:

{
"success": false,
"message": "Invalid data",
"errors": [
{
"message": "Required",
"path": "config"
}
]
}

If everything is correct you should have a response with the created workflow. Here is an example request:

POST https://api.scrapeautomate.com/workflow/create/?apiKey=<exampleApiKey>
Content-Type: application/json

{
"name": "Test workflow",
"config": {
"url": "https://example.com",
"screenshot": true
}
}

Response:

{
"id": "cm4xo3ob60001v2o27d10ni8g",
"userId": "cm4qt32l60004tr5e4p8xxjqb",
"config": {
"url": "https://example.com",
"render": false,
"screenshot": true
},
"name": "Test workflow",
"lastRun": null,
"creditsSpent": 0,
"createdAt": "2024-12-21T04:16:45.523Z",
"updatedAt": "2024-12-21T04:16:45.523Z",
"archived": false
}

Archive a workflow

To archive a workflow you need to set an DELETE request to the following api, with the workflow id you want to archive and your api key for authentication.

DELETE https://api.scrapeautomate.com/workflow/archive/${workflowId}?apiKey=<exampleApiKey>

After you send the request you will notice that your workflow has been automatically archived. Once a request has been archived you will no longer be able to edit or use the workflow. If you would like to revert this you may unacrhive the workflow.

Unarchive a workflow

If you would like to unarchive a workflow you need to send an POST request to the following api, with the workflow id you want to unarchive and your api key.

POST https://api.scrapeautomate.com/workflow/archive/${workflowId}?apiKey=<exampleApiKey>

Once you send an request and if everything is successful you will be able to use and edit that workflow again.

Edit a workflow

If you would like to edit the name or the configuration of the workflow, its very simple. You just need to send an PATCH to the following api with the field you would like to update such as the name or the config field. No other field is editable. Here is an example:

PATCH https://api.scrapeautomate.com/workflow/edit/${workflowId}?apiKey=<exampleApiKey>
Content-Type: application/json

{
"name": "Updated name",
"config": {
"url": "https://updatedurl.com",
"screenshot": true,
"render": true
}
}

This will update the api workflow with that id with the updated fields such as name and config. In the response you should get the updated workflow like this:

{
"id": "cm4tiiugd0000bm65pmfs56vt",
"userId": "cm4qt32l60004tr5e4p8xxjqb",
"config": {
"url": "https://updatedurl.com",
"screenshot": true
},
"name": "Updated name",
"lastRun": "2024-12-18T06:50:04.541Z",
"creditsSpent": 2,
"createdAt": "2024-12-18T06:29:30.926Z",
"updatedAt": "2024-12-18T06:29:30.926Z",
"archived": false
}