Skip to content

Request a presigned URL to upload a policy PDF

POST
/v1/policies/{id}/pdf/upload-url
curl --request POST \
--url https://api.varman.io/v1/policies/pol_abc123def456/pdf/upload-url \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--data '{ "versionId": "pv_abc123def456", "fileName": "acceptable-use-v1.pdf", "fileType": "application/pdf" }'

Generates a presigned S3 URL for uploading a policy PDF directly to storage. Use this when attaching a PDF to a compliance policy — the file bytes are uploaded straight to S3 without passing through the API. Requires the policy ID; if you only know the policy name, look it up first via the list-compliance-policies tool. After uploading the file to the returned URL, finalize the attachment by calling confirm-policy-pdf-uploaded with the same s3Key.

id
required
string

Example

pol_abc123def456

Policy ID

X-Organization-Id
string

Organization ID (required for session auth, optional for API key auth)

Media typeapplication/json
object
versionId

Optional version ID to attach the PDF to. Omit to attach the PDF at the policy level (legacy path).

string

Example

pv_abc123def456
fileName
required

Filename of the PDF (e.g., “policy-v1.pdf”). Non-alphanumeric characters will be replaced with underscores when storing in S3.

string

Example

acceptable-use-v1.pdf
fileType
required

MIME type of the file. Must be “application/pdf” — the presigned URL enforces this at upload time.

string

Example

application/pdf
Media typeapplication/json
object
uploadUrl
required

Presigned S3 URL. PUT the raw file bytes to this URL with header Content-Type: application/pdf. No auth headers required — the signature is in the URL.

string
s3Key
required

The S3 key the file will land at. Pass this back to the confirm endpoint after a successful upload.

string
expiresIn
required

Seconds until the presigned URL expires.

number

Example

{
"uploadUrl": "https://bucket.s3.us-east-1.amazonaws.com/org_xxx/policies/pol_xxx/...?X-Amz-Signature=...",
"s3Key": "org_abc/policies/pol_xyz/1735000000-acceptable-use-v1.pdf",
"expiresIn": 900
}