Skip to content

Using the REST API in the S-Filer Portal Solution ​

This document aims to guide you in using the REST API of the S-Filer Portal solution.

Warning

The SOAP web service API (/sfiler/services/SFilerWS endpoint, ws-client JAR client) is deprecated. S-Filer Portal 4.21.x is the last version to offer it: it is removed in version 4.22.0, and no version or feature flag can bring it back. Migrate your SOAP integrations to the REST API before you upgrade to 4.22.0. See Deprecation of the SOAP API.

REST API Exposure ​

By default, the S-Filer Portal solution's REST API is exposed at https://[URL_SERVER_SFILER]/sfiler/server/api/vX/ (where X is the API version), together with its complete documentation. You can restrict which part of that documentation is displayed. To do so, use the S-Filer Portal Administrative Console.

  1. Open the S-Filer Portal Administrative Console.
  2. From the left menu, select the Configuration link of the S-Filer Portal Server.
  3. Then select the REST API Exposition link.
  4. Use the Activate Documentation Filtering drop-down list to choose which services are documented.
    1. Select Yes to filter the documented services: only the endpoints you select are documented.
    2. Select No to display the documentation of every REST API service.
  5. If you selected Yes, select the endpoints whose documentation must be displayed.
  6. Click the Save button.

REST API Exposition

Warning

REST API exposure does not affect the availability of the services. Every endpoint remains registered and usable even when it is not documented, since the S-Filer Portal web interface relies on them. Exposure only restricts the display of the documentation (the Swagger interface). Access to a service always depends on the caller's authentication and permissions.

API Versioning ​

Historically, the S-Filer Portal solution only had two versions of the REST API: V1, which was the stable version, and V2, which was the experimental version subject to change between releases. With the advent of high availability and backward compatibility, we revised this model for version 4.21.0. This means that:

  • Starting from version 4.21.0, each new version of the S-Filer Portal solution will include a new version of the REST API.
  • Version 4.20 works as described above and includes only the V1 and V2 versions.
  • Version 4.21 contains a new V3 version and continues to maintain V1 and V2, which are stable.
  • Version 4.22 will contain a new V4 version, as well as the same versions as 4.21, namely V1, V2 and V3.
  • Version 4.23 will contain a new V5 version and will continue to maintain V1, V2, V3 and V4, which will remain stable.
  • OKIOK will maintain approximately 5 stable versions simultaneously.

Warning

A new version of the REST API comes with each new minor and major version of the solution. However, this new version is not available until the version flag of the release is enabled. In version 4.21, as long as the Version 4.21 version flag is not enabled, the V3 endpoints reject every request with an HTTP 403 status, code 8005 and the message This version of the API is not activated. Only the notification theme content services escape that restriction, so that you can prepare your templates before enabling the flag. A version flag is enabled from the Administrative Console or with the sfiler-config-cli utility; see Version flags and Enabling and disabling.

Warning

A stable version of the REST API does not change except when errors are detected and fixed. It is therefore recommended to review the documented changes when a new version of the solution becomes available. Any changes to the REST API are documented in the upgrade documentation.

Compatibility Between API Versions ​

We recommend always using the most recent version of the API. This lets you take advantage of the latest features of the application through the REST API. New features are not backported to previous versions of the API. Older versions can still be used, but this may cause some problems. For example, version 4.21 of the solution introduces smart notifications. This feature lets users decide how the application notifies them. In the V2 API, a GET on a user's profile only gives access to a boolean useMailNotification flag indicating whether the user wishes to be notified (true) or not (false).

json
{
    "id": 1,
    "domainId": 1,
    "userName": "my-user",
    "creationDate": "2025-04-09T19:42:42.954Z",
    "displayName": "My User",
    "email": "my-user@sfiler.com",
    "language": "fr",
    "reference": "",
    "useMailNotification": true,
    "useApplet": false,
    "serviceAccount": true,
    "folderId": 28,
    "publicKey": "",
    "defaultPath": "/",
    "expirationDate": null,
    "notEditableByUser": false,
    "userCannotChangePassword": false,
    "changePasswordAtNextLogon": false,
    "userQuota": 1111,
    "userRole": 0,
    "uploadToInboxPermitted": true,
    "inactivityDate": "2026-01-21T20:15:44.310Z",
    "status": "OK",
    "mfaEnforced": false,
    "mfaEnabled": false
}

Starting from version 4.21, once the version flag is enabled, the feature is available in the V3 API (the V2 version remains available and behaves the same way as in version 4.20 of the solution). The REST API returns the user's preference through the mailConsolidationStrategy field:

json
{
    "id": 1,
    "domain": {
        "id": 1,
        "name": "internal"
    },
    "userName": "my-user",
    "creationDate": "2025-04-09T19:42:42.954Z",
    "displayName": "My User",
    "email": "my-user@sfiler.com",
    "language": "fr",
    "reference": "",
    "mailConsolidationStrategy": "SMART",
    "useApplet": false,
    "serviceAccount": true,
    "folderId": 28,
    "publicKey": "",
    "defaultPath": "/",
    "expirationDate": null,
    "notEditableByUser": false,
    "userCannotChangePassword": false,
    "changePasswordAtNextLogon": false,
    "userQuota": 1111,
    "userRole": 0,
    "uploadToInboxPermitted": true,
    "inactivityDate": "2026-01-21T20:15:44.310Z",
    "status": "OK",
    "mfaEnforced": false,
    "mfaEnabled": false
}

Since the V2 API is still available, the user's notification preference can still be changed through the useMailNotification field. However, the V2 API does not offer the same choices as the V3 API. Even though the V2 API can still be used, it could lead to unwanted behaviour in a scenario like this one:

  1. Version 4.21 of the solution is enabled.
  2. A user enables smart notifications so as to receive a single email per day (DAILY value).
  3. A call is made to the V2 API to modify that user's profile, using the value true for the useMailNotification field.

In this scenario, since the V2 API only knows two values (notifications enabled, true, or disabled, false), the system replaces the user's preference for a daily notification (DAILY value) with the only value known to V2, which is to send a notification as soon as an action is performed on the system.

To avoid such a scenario, keep track of the changes made to the API from one version to the next. These changes are described in a migration document specific to each version, available in the Upgrading section.

The UNSUPPORTED Enumeration Value ​

Many REST API values are represented by enumerations. For example, the notification strategy introduced in the V3 API applies to the "User" entity:

yaml
        mailConsolidationStrategy:
          type: string
          description: |
            Strategy used to send email notifications to the user.
             * SMART: Consolidate notifications sent in rapid succession.
             * IMMEDIATE: Send each notification separately and immediately.
             * DAILY: Send a daily summary of notifications.
             * NONE: Disable notifications.
             * UNSUPPORTED: The user mail consolidation strategy is not supported by the current version of this REST API.
            
            When the mail consolidation feature is enabled, the default value is SMART.
            When the mail consolidation feature is disabled, the DAILY and SMART values are invalid and the default value is IMMEDIATE.
          enum:
            - SMART
            - IMMEDIATE
            - DAILY
            - NONE
            - UNSUPPORTED

Suppose a new WEEKLY value were introduced in the V4 API: the V3 API would not be able to handle it correctly. That is why enumerations of the API that are tied to an entity have an UNSUPPORTED value. It tells a version of the API that it is handling a value its version does not know. So, if the WEEKLY value were introduced in version 4.22 of the solution and a V3 API call were made for a user set to WEEKLY, the value UNSUPPORTED would be returned. As stated in the section on compatibility between API versions, new features are not adapted to previous versions of the API. Clients of services that can return a field set to UNSUPPORTED must be able to handle that situation. All the API enumeration fields that may be affected already include the UNSUPPORTED value.

Warning

The UNSUPPORTED value can be used in a request, since it belongs to the set of values accepted by the schema. However, every request containing it is rejected with an HTTP 400 status and code 5018 (for example, MailConsolidationStrategy cannot be UNSUPPORTED.).

Using the Swagger File ​

You can always consult the Swagger file of the S-Filer Portal REST API for complete documentation of the available resources and operations. The Swagger file is available at the following URL: https://[URL_SERVER_SFILER]/sfiler/server/api/[API_VERSION]/docs/swagger-server-external-[API_VERSION]-api.yaml.

Replace the items between brackets with the matching values. For example, if your S-Filer Portal server is reachable at https://www.example.com and the API version is version 3, the URL of the Swagger file is https://www.example.com/sfiler/server/api/v3/docs/swagger-server-external-v3-api.yaml.

The Swagger documentation can also be browsed online at the following URL: https://www.example.com/sfiler/server/api/v3/docs/.

Authentication ​

The S-Filer Portal REST API uses a token-based authentication mechanism. To access the various features of the API, you must first obtain an authentication token using your login credentials. This token must then be included in the headers of all subsequent API requests.

Obtaining an Authentication Token ​

To obtain an authentication token, send a POST request to the /api/v3/auth/login endpoint with your login credentials in the request body: the username (userName), the password (password) and, optionally, the identifier of the authentication domain (domainId; the internal domain is always 1).

Request Example:

http
POST /api/v3/auth/login HTTP/1.1
Host: www.example.com
Content-Type: application/json

{
  "userName": "my-username",
  "password": "my-password",
  "domainId": 1
}

Response Example:

json
{
  "authenticationToken": "g4+Nbrsw1e6XMiFhCt+1gg==",
  "mfaEnforced": false,
  "mfaEnabled": false,
  "passwordExpired": false,
  "enabledMfaMethods": [
    "TOTP",
    "EMAIL_OTP"
  ]
}
FieldDescription
authenticationTokenThe authentication token to send with the following requests.
mfaEnforcedA second authentication factor must be provided because multi-factor authentication (MFA) is enforced for this user. If the user has not configured any MFA method yet, they must configure one of the enabled methods.
mfaEnabledA second authentication factor must be provided because the user has enabled MFA.
passwordExpiredThe password is expired and must be changed.
enabledMfaMethodsThe MFA methods enabled by the administrator for the instance (TOTP, EMAIL_OTP, SMS_OTP).

Multi-Factor Authentication and Expired Passwords ​

When mfaEnforced, mfaEnabled or passwordExpired is true, the token returned by the login only allows completing the authentication. Proceed as follows, sending the authToken header with each call:

  1. Check the mfaEnforced, mfaEnabled and passwordExpired flags of the login response.
  2. If MFA is required, call GET /auth/mfa/configured-methods to list the methods configured for the user and obtain their identifier.
  3. For an EMAIL_OTP or SMS_OTP method, call POST /auth/mfa/{configuredMethodId}/send-code to have the code sent to the user.
  4. Call POST /auth/mfa/{configuredMethodId}/validate-code with the code, or POST /auth/mfa/validate-long-lived-token with a long-lived token obtained during a previous validation.
  5. If the password is expired (an HTTP 206 status returned by the MFA validation also indicates this), call POST /auth/change-password.

The payloads of these calls are described in the Swagger documentation.

Example

For an integration (script, automated process), use a service account: MFA is never enforced for service accounts, so the token obtained at login can be used directly.

Using the Authentication Token ​

Once you have obtained the authentication token, include it in the headers of all subsequent API requests using the authToken header.

http
GET /api/v3/users HTTP/1.1
Host: www.example.com
authToken: g4+Nbrsw1e6XMiFhCt+1gg==

Request Correlation ​

Available in4.21.0 +

Every endpoint accepts an optional X-REQUEST-ID request header, and the response returns one. It holds the identifier the call is logged under, so quoting it lets support follow the call across the solution's components.

  • A supplied value is kept only when it is 1 to 64 characters long and contains only letters, digits, ., _ and - ([A-Za-z0-9._-]).
  • Any other value is rejected and replaced by a generated identifier. A missing header also gets a generated identifier.
  • The X-REQUEST-ID response header holds the identifier actually used. It is missing only from responses sent before the identifier is assigned, such as a request the server rejects as malformed (400 Bad Request) or a CORS preflight request.

Example request:

http
GET /api/v3/users HTTP/1.1
Host: www.example.com
authToken: g4+Nbrsw1e6XMiFhCt+1gg==
X-REQUEST-ID: nightly-sync.20261027.42

Example response headers:

http
HTTP/1.1 200 OK
X-REQUEST-ID: nightly-sync.20261027.42

The header is not listed among the parameters of each endpoint in the Swagger documentation. It is described once, at the top of the Swagger page.

See Also

Request Correlation in the logging guide.

Error Handling ​

The S-Filer Portal REST API uses HTTP status codes to indicate the success or failure of requests. When a request fails, the response body contains an error object with the following fields:

  • code: the application error code (see Application Error Codes);
  • message: a description of the error, usually the description of the operation that failed;
  • fields: currently always null.

Warning

Error messages are in English and are not translated into the user's language.

Common Error Codes ​

  • 400 Bad Request: The request is invalid or malformed. Check the request parameters.
  • 401 Unauthorized: Authentication failed (invalid or expired token) or the authenticated user is not allowed to perform the operation (code 4000).
  • 403 Forbidden: The operation is refused, for example because the feature is disabled or because the targeted API version is not enabled (code 8005).
  • 404 Not Found: The requested resource was not found.
  • 409 Conflict: A resource with the same name already exists.
  • 413 Request Entity Too Large: The request or the transfer exceeds a size limit or a quota.
  • 500 Internal Server Error: An internal server error occurred. Try again later or contact support.
  • 503 Service Unavailable: The system or a storage is temporarily unavailable. Try again later.

Example Error Responses ​

Here are some typical error responses you might encounter when using the S-Filer Portal REST API. The complete list of application codes, with the HTTP status of each one, is available in Application Error Codes.

400 Bad Request ​

A required field is missing when creating a user (POST /users):

json
{
  "code": 5018,
  "message": "Invalid username.",
  "fields": null
}

The request body is not valid JSON:

json
{
  "code": 5018,
  "message": "Invalid request payload.",
  "fields": null
}

401 Unauthorized ​

The authentication token is invalid (GET /users/23):

json
{
  "code": 3000,
  "message": "Failed to retrieve user by user identifier: 23",
  "fields": null
}

The authenticated user is not allowed to create users (POST /users):

json
{
  "code": 4000,
  "message": "Failed to create user",
  "fields": null
}

403 Forbidden ​

The V3 API is called while the Version 4.21 version flag is not enabled:

json
{
  "code": 8005,
  "message": "This version of the API is not activated",
  "fields": null
}

404 Not Found ​

The requested user does not exist (GET /users/23):

json
{
  "code": 5000,
  "message": "Failed to retrieve user by user identifier: 23",
  "fields": null
}

409 Conflict ​

A community with the same name already exists (POST /communities):

json
{
  "code": 5001,
  "message": "The community name (Finance) already exists.",
  "fields": null
}

413 Request Entity Too Large ​

The request content exceeds the configured limit:

json
{
  "code": 9002,
  "message": "The request size is 2450 KB, which exceeds the configured limit of 2000 KB.",
  "fields": null
}

500 Internal Server Error ​

This error can be caused by an internal server problem or a bug in the code. If you encounter this error, contact support or check the server application logs for more context on the error. The message describes the operation that failed.

json
{
  "code": 10000,
  "message": "Failed to create user",
  "fields": null
}

503 Service Unavailable ​

A transfer is refused because the system is overloaded (POST /http/node):

json
{
  "code": 20002,
  "message": "The transfer has been refused because the system is overloaded. Please try again later.",
  "fields": null
}