Switch storage between platform and customer S3 bucket
curl -X PUT 'https://api.justcrawl.io/api/v1/integrations/storage' \ -H 'Authorization: Bearer $JUSTCRAWL_API_KEY' \ -H 'Content-Type: application/json' \ -d '{"type":"custom","bucket":"my-scrape-results","accessKeyId":"AKIA...","secretAccessKey":"...","region":"us-east-1","documentExpiryDays":90}'Switches where this org’s job result blobs are written. Two paths:
type: "platform"— reset to JustCrawl-managed storage. Bucket and credentials fields are ignored. Side-effect free; the existing encrypted bucket credentials (if any) are wiped from the DB.type: "custom"— switch to a customer-owned S3 bucket. Requiresbucket+accessKeyId+secretAccessKey+region. Credentials are validated synchronously by uploading then deleting a test object at a unique test key against the supplied bucket. If verification fails, the call returns a generic 400 and does not persist anything. On success the bucket’sGetBucketVersioningis read to setstorageVersioningEnabled(drives the_v1/_v2suffix fallback); credentials are AES-256-GCM encrypted at rest.
Each custom save reconciles the org’s stored retention preference. A positive
documentExpiryDays (1–3650) installs justcrawl-retention-<orgId> on its
scrape-object prefix, with a seven-day grace period. Enabled versioning selects
noncurrent versions. An explicit null removes the managed rule. Omission keeps
the stored preference. Unrelated rules and transition defaults are preserved.
An unreadable policy, unknown versioning for an expiration, ambiguous legacy
rule or failed policy write returns lifecycleWarning; the storage connection
is saved and the prior retention preference is kept. Unknown versioning is
reported as null with versioningWarning. Saves competing for the same
organization or customer bucket return 409 and can be retried. Replacing or disconnecting
a historical bucket can return a lifecycle warning to inspect its existing bucket-wide rule.
The gateway makes no S3 requests to the bucket being disconnected.
Requires the org:manage permission.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Required when type=custom. S3 bucket name.
Required when type=custom. Validated by a PutObject + DeleteObject roundtrip.
Required when type=custom. AES-256-GCM encrypted at rest.
Required when type=custom. AWS region (e.g. us-east-1).
1–3650 inclusive, or null to remove the managed expiration rule. The prior preference is retained on a lifecycle warning.
Responses
Section titled “Responses”New storage config. Includes optional versioningWarning and lifecycleWarning fields when applicable.
object
Example
{ "type": "platform"}Validation failed — request body or query is missing/invalid
object
Example
{ "error": "Missing or invalid \"url\" field"}Missing or invalid authentication token
object
Example
{ "error": "Missing or invalid authentication token"}Insufficient permissions for this operation
object
Example
{ "error": "No organization. Complete onboarding first."}A storage update is in progress for this organization or bucket.
Unexpected server error. Logs and PostHog $exception capture
object
Example
{ "error": "Something went wrong"}