Authentication
There are two ways to authenticate: API Key authentication and Session-based authentication.
Authenticate with an API Key
Authenticating with an API key is the recommended authentication method for most scenarios, and is the method used in the examples on this site.
To use an API Key, first generate an API key from the web interface or via the API or an SDK.
A user key follows its account's permissions, narrowed by the key's permission scope, Workspace, and any path restriction on file operations. It can perform administrative operations only when both the account and key permit them. API Keys explains credential scope and lifecycle; Workspaces explains request context and delegated administration.
Setting by Environment Variable on MacOS or Linux
Setting by Environment Variable on Windows
Noteworthy
Don't forget to replace the placeholder, YOUR_API_KEY, with your actual API key.
Authenticate with a Session
Create a session with the username and password of an active user. The session uses that user's permissions, including any delegated administrative access. Workspaces describes account scope and administrative access.
Sessions use the exact same session timeout settings as web interface sessions. When a session times out, simply create a new session and resume where you left off. This process is not automatically handled by our SDKs because we do not want to store password information in memory without your explicit consent.
Logging In
To log in to the CLI App with your username and password, you must first configure the CLI App with information about your Files.com account.
Once you've specified your subdomain information and username, you do not need to specify it again for subsequent uses of the CLI App.
You will be prompted for the password when a command is run that requires authentication. Once the password is entered, subsequent calls will not require a password, unless the session is no longer valid (ie, expired).
Using a Session
Once the password has been verified by the first run command, all subsequent commands can be run and the current verified session will be used.
You can also provide an existing session ID directly with --session-id, or store it with files-cli config set --session-id.
Logging Out
User sessions can be ended by calling sessions delete.