Log in to a database session

To log in to a hosted database, use an HTTP POST method with the sessions API endpoint specifying the name of a hosted database. The account name and password are specified in a header Authorization string. If the account name and password are authenticated, your code receives an access token that defines your connection to the database. This connection is called a database session.

HTTP method

POST

URL

/fmi/data/version/databases/database-name/sessions

version – the FileMaker Data API version requested can use v1, v2, or vLatest

database-name – the name of the hosted database

HTTP headers

Content-Type: application/json

Authorization: a base64-encoded string representing the account name and password to use to log in to the hosted database. This base64-encoded string should follow the standard HTTP Basic Authentication Scheme. (The account name and password are separated by a colon.)

Parameters

An empty set of curly braces. For example: { }

May optionally use the fmDataSource parameter to log in to an external data source. See Log in to an external data source.

Response

The access token, a response body with the access token, and a messages array showing an error code of 0.

The X-FM-Data-Access-Token header is returned in response, which is the session token to be used for subsequent API calls.

For example:

Copy
Header:
  "X-FM-Data-Access-Token": "c4d2e429122e9cdeda19bb23c55cd2a8f282c3cc50c60943a110"
{
Body:
  "messages": [
    {
      "message": "OK"
      "code": "0"
    }
  ], 
  "response": {
    "token": "c4d2e429122e9cdeda19bb23c55cd2a8f282c3cc50c60943a110"
  }, 
  "HTTPMessage": "OK"
  "HTTPCode": 200
}

See Error responses.