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  database-name – the name of the hosted database  | 
                                                
| 
                                                         HTTP headers  | 
                                                    
                                                         Content-Type: application/json Authorization: Basic account:password 
  | 
                                                
| Parameters | 
                                                         An empty set of curly braces. For example:  May optionally use the   | 
                                                
| 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
                                                             
                                                        Body 
                                                            
                                                            See Error responses.  | 
                                                
Example
Example request:
curl --request POST \
  --url https://ServerDomain/fmi/data/vLatest/databases/DatabaseName/sessions \
  --header 'Authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'Content-Type: application/json'
                                            Example response:
{
  "response": {
    "token": "c4d2e429122e9cdeda19bb23c55cd2a8f282c3cc50c60943a110"
  },
  "messages": [
    {
      "message": "OK", 
      "code": "0"
    }
  ]
}