---
updatedAt: 2025-11-13T22:00:05.000Z
agentTools:
  projectIndex: https://coldstream.readme.io/llms.txt
---

# Login user

n function to get the authentication key, this key is automatically stored in the API object

```python
    def login(self, email, password):
    
        login_url = self.identity_url + "/account/login"
        payload = json.dumps({"email": email, "password": password})

        response = requests.post(login_url, data=payload, headers=self.put_header_login)

        print("login response:", "\n")
        print(response.text, "\n")

        self.auth = "Bearer " + response.text.split(':')[1][1:-2]
```

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Identity API",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://identity.coldstream.diabatix.com"
    }
  ],
  "paths": {
    "/account/login": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Login user",
        "description": "Returns a JWT authorization token for a successful login request",
        "parameters": [
          {
            "name": "identityToken",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginUserModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginUserModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginUserModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "LoginUserModel": {
        "required": [
          "email",
          "password"
        ],
        "type": "object",
        "properties": {
          "email": {
            "minLength": 1,
            "type": "string",
            "format": "email"
          },
          "password": {
            "minLength": 12,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Token": {
        "type": "object",
        "properties": {
          "accessToken": {
            "type": "string",
            "nullable": true
          },
          "mfaToken": {
            "type": "string",
            "nullable": true
          },
          "barcodeUri": {
            "type": "string",
            "nullable": true
          },
          "recoveryCode": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below.\r\n\r\nExample: \"Bearer 12345abcdef\"",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": []
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true,
    "samples-enabled": true
  }
}
```