cURL example for file URL uploads
cURL is the fastest way to validate that your API key, multipart request, visibility field, and JSON response mapping work before adding application code.
- Reviewed by
- GetFileURL technical team
- Updated
- Language
- cURL
- Input
- invoice.pdf
- Output
- url and file_id
What this page answers
It returns JSON fields including the direct public URL, file ID, content type, and expiry metadata when a retention window is set.
- Reviewed by
- GetFileURL technical team
- Last updated
One request in, a URL and JSON out
curl -X POST https://api.getfileurl.com/v1/files \
-H 'Authorization: Bearer $GETFILEURL_KEY' \
-F 'file=@invoice.pdf' \
-F 'visibility=public'Start with cURL when you need a clean baseline.
A terminal request removes browser, framework, and automation platform behavior from the first test.
Validate auth
Confirm the bearer key works before wiring it into an application or automation credential store.
Inspect JSON
Verify that `url`, `file_id`, `content_type`, and `expires_at` are present before mapping fields onward.
Reproduce errors
Use cURL to reproduce unsupported type, file size, expiry, and auth issues without hidden client code.
Move the same request shape into the runtime that owns the workflow.
After cURL works, keep the field names the same and move the request into a backend, worker, script, or automation HTTP module.
Keep key secret
Use environment variables, worker secrets, or automation credentials instead of hard-coded keys.
Pass only url onward
Most destination APIs need only the direct file URL, not the entire response object.
Store cleanup data
Keep `file_id` and `expires_at` near the job record for delete and retry branches.
Copy the same upload shape into code
curl -X POST https://api.getfileurl.com/v1/files \
-H 'Authorization: Bearer $GETFILEURL_KEY' \
-F 'file=@invoice.pdf' \
-F 'visibility=public'Common questions
What does the cURL example return?
It returns JSON fields including the direct public URL, file ID, content type, and expiry metadata when a retention window is set.
Where should I store the API key?
Store the key in a server environment variable, worker secret, script secret manager, or trusted automation credential store.
What should I do after getting the URL?
Pass `url` to the next API and store `file_id` if the workflow should delete or inspect the file later.