Skip to content

Apply suggestion

POST
/api/v1/workflows/{workflowId}/smart/suggestions/{id}/apply
curl --request POST \
--url https://dashboard.justcrawl.io/api/v1/workflows/example/smart/suggestions/example/apply \
--header 'Authorization: Bearer <token>'

Atomically applies a pending suggestion: rewrites the workflow’s provider order to match the suggestion’s suggested_provider_order, regenerates the DAG, and marks the suggestion applied. Uses SELECT FOR UPDATE on the suggestion row inside a single transaction so concurrent apply attempts from two browser tabs can’t double-spend the suggestion.

Returns 400 when the suggestion is already applied or dismissed — by design, each suggestion is one-shot. Returns 404 for missing suggestions or non-smart workflows (the lookup is org-scoped so cross-tenant probes 404 indistinguishably). Requires workflows:write.

workflowId
required
string
id
required
string

Suggestion applied; DAG regenerated.

Media type application/json
object
workflowId
string
providerOrder
Array<string>
Example generated
{
"workflowId": "example",
"providerOrder": [
"example"
]
}

Validation failed — request body or query is missing/invalid

Media type application/json
object
error
string
Example
{
"error": "Missing or invalid \"url\" field"
}

Missing or invalid authentication token

Media type application/json
object
error
string
Example
{
"error": "Missing or invalid authentication token"
}

Insufficient permissions for this operation

Media type application/json
object
error
string
Example
{
"error": "No organization. Complete onboarding first."
}

Resource not found

Media type application/json
object
error
string
Example
{
"error": "Workflow not found"
}

Unexpected server error. Logs and PostHog $exception capture

Media type application/json
object
error
string
Example
{
"error": "Something went wrong"
}