cURL example

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
curl file uploadmultipart/form-dataBearer authterminal test
Example
Language
cURL
Input
invoice.pdf
Output
url and file_id
Short answer

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
Handoff

One request in, a URL and JSON out

Request
curl -X POST https://api.getfileurl.com/v1/files \
  -H 'Authorization: Bearer $GETFILEURL_KEY' \
  -F 'file=@invoice.pdf' \
  -F 'visibility=public'
When to use

Start with cURL when you need a clean baseline.

A terminal request removes browser, framework, and automation platform behavior from the first test.

01

Validate auth

Confirm the bearer key works before wiring it into an application or automation credential store.

02

Inspect JSON

Verify that `url`, `file_id`, `content_type`, and `expires_at` are present before mapping fields onward.

03

Reproduce errors

Use cURL to reproduce unsupported type, file size, expiry, and auth issues without hidden client code.

Next step

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.

01

Keep key secret

Use environment variables, worker secrets, or automation credentials instead of hard-coded keys.

02

Pass only url onward

Most destination APIs need only the direct file URL, not the entire response object.

03

Store cleanup data

Keep `file_id` and `expires_at` near the job record for delete and retry branches.

Examples

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'
FAQ

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.