Request a presigned URL to upload a policy PDF
const url = 'https://api.varman.io/v1/policies/pol_abc123def456/pdf/upload-url';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"versionId":"pv_abc123def456","fileName":"acceptable-use-v1.pdf","fileType":"application/pdf"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
pol_abc123def456Policy ID
Header Parameters
Section titled “Header Parameters”Organization ID (required for session auth, optional for API key auth)
Request Bodyrequired
Section titled “Request Bodyrequired”object
Optional version ID to attach the PDF to. Omit to attach the PDF at the policy level (legacy path).
Example
pv_abc123def456Filename of the PDF (e.g., “policy-v1.pdf”). Non-alphanumeric characters will be replaced with underscores when storing in S3.
Example
acceptable-use-v1.pdfMIME type of the file. Must be “application/pdf” — the presigned URL enforces this at upload time.
Example
application/pdfResponses
Section titled “Responses”object
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.
The S3 key the file will land at. Pass this back to the confirm endpoint after a successful upload.
Seconds until the presigned URL expires.
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}