Skip to content
Luna
Esc
↑↓navigate↵open⌘Jpreview

Sign a URL for a file

Returns a signed URL that downloads one file or, with upload, uploads it. The URL is a path on the environment’s own address and works without a token until it expires. A download URL needs data:read. An upload URL needs data:write.

POST/_luna/tenants/{tenant}/files/{type}/{bucket}/sign
Authorization
AuthorizationBearer token · headerrequired

An account key (la_…), an API key (lt_…) or a session token (ls_…). The scopes listed are the permissions the operation needs.

Scopes:data:read
Path parameters
tenantstringrequired

The tenant, by its name.

typestringrequired

The luna type, by its name.

bucketstringrequired

The bucket, by its name.

Request body
requiredapplication/json
keyanyrequired

The luna's key as JSON, such as {"id":"a"}. For a type keyed by one field, the value of that field alone also works.

pathstringrequired

The file's path in the bucket.

uploadboolean | null

True for a URL that uploads the file with PUT. False, the default, for one that downloads it with GET.

expiresInMsinteger<int64> | null

How long the URL works for, in milliseconds.

min 0
contentTypestring | null

The content type an upload must send.

maxSizeinteger<int64> | null

The largest upload the URL accepts, in bytes.

min 0
Responses
200

The signed URL.

urlstringrequired

A path on the environment's own address, with the signature in its query.

methodstringrequired

PUT for an upload, GET for a download.

expiresinteger<int64>required

When the URL stops working, in milliseconds since the Unix epoch.

min 0
default

The request failed. The status says how and error.message says why.

errorErrorDetailrequired
Show properties
codestring | null

A code for programs to branch on, when the error has one.

messagestringrequired

What went wrong, in a sentence a person can read.

Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'https://luna.example.com/_luna/tenants/string/files/string/string/sign' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "key": null,
  "path": "string",
  "upload": true,
  "expiresInMs": 0,
  "contentType": "string",
  "maxSize": 0
}'
Response
{
  "url": "string",
  "method": "string",
  "expires": 0
}

Was this page helpful?