Sessions

A Session is an operation that allows you to make further API calls using our REST API or SDKs as a specific user. This is the only way to use the API if you know a username/password but not an API key.

Sessions in the API and SDKs use the exact same mechanism (and work the same) as sessions in the web interface.

After creating a session, the Session object returned will include plenty of relevant information about the current user, often used to customize the interface or enable further automation.

Create user session (log in)

Endpoint

POST/sessions

Return Object

Session

Authorization Requirement

No authentication required; you may call this endpoint without a key or session.

Request Parameters

ParameterDescription
username
string
Username to sign in as
password
string
Password for sign in
otp
string
If this user has a 2FA device, provide its OTP or code here.
partial_session_id
string
Identifier for a partially-completed login

Example Request

curl https://app.files.com/api/rest/v1/sessions.json \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"username":"username","password":"password","otp":"123456"}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "id": "60525f92e859c4c3d74cb02fd176b1525901b525",
  "language": "en",
  "read_only": true,
  "sftp_insecure_ciphers": false
}

Delete user session (log out)

Endpoint

DELETE/sessions

Return Object

No return value.

Authorization Requirement

No authentication required; you may call this endpoint without a key or session.

Example Request

curl https://app.files.com/api/rest/v1/sessions.json \
  -X DELETE \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

The Session Object

Some of the endpoints above return a Session object. The attributes of this object are listed below.

AttributeDescription
id
string
Session ID
language
string
Session language
read_only
boolean
Is this session read only?
sftp_insecure_ciphers
boolean
Are insecure SFTP ciphers allowed for this user? (If this is set to true, the site administrator has signaled that it is ok to use less secure SSH ciphers for this user.)

Example Session Object

{
  "id": "60525f92e859c4c3d74cb02fd176b1525901b525",
  "language": "en",
  "read_only": true,
  "sftp_insecure_ciphers": false
}