Mint a personal API token.
POST
/v1/account/api-tokens
const url = 'https://api.share2.us/v1/account/api-tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"label":"example","scopes":["shares:read"],"expires_in_days":1}'};
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.share2.us/v1/account/api-tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "label": "example", "scopes": [ "shares:read" ], "expires_in_days": 1 }'Creates a scoped, revocable personal access token. The raw token (s2u_pat_…) is returned exactly once in this response and never again. Enforces the plan’s api_token_limit. Requires an interactive login.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
label
required
string
scopes
required
Array<string>
expires_in_days
Days until expiry. 0 or omitted means no expiry.
integer
Responses
Section titled “Responses”Token created. token is shown only here.
Media typeapplication/json
object
token
required
The raw token (s2u_pat_…). Shown only in this response — store it securely.
string
api_token
required
A personal access token as shown to its owner (never the secret).
object
id
required
string format: uuid
label
required
string
scopes
required
Array<string>
token_hint
Masked display form, e.g. “s2u_pat_…9f3a”. Never the full secret.
string
last_used_at
string format: date-time
expires_at
string format: date-time
revoked_at
string format: date-time
created_at
required
string format: date-time
Example
{ "api_token": { "scopes": [ "shares:read" ] }}Plan limit reached (api_token_limit_reached) or session required.
default
Section titled “default”Standard error envelope.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
request_id
required
string
Example
{ "error": { "code": "quota_exceeded" }}