{
  "openapi": "3.1.0",
  "info": {
    "title": "Generate JWT",
    "description": "Sign in externally and generate a JWT token to authenticate the user.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.brewit.ai/v1"
    }
  ],
  "paths": {
    "/auth/signin_external": {
      "post": {
        "summary": "Generate JWT",
        "description": "Sign in externally and generate a JWT token to authenticate the user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_id": {
                    "type": "string",
                    "description": "Identifier of the user in your system."
                  },
                  "ttl_seconds": {
                    "type": "number",
                    "description": "Time-to-live of the JWT token in seconds."
                  },
                  "display_name": {
                    "type": "string",
                    "description": "Display name of the user."
                  },
                  "email": {
                    "type": "string",
                    "description": "Email of the user."
                  },
                  "picture": {
                    "type": "string",
                    "description": "URL of the user's picture."
                  }
                },
                "required": ["external_id", "ttl_seconds"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string",
                      "description": "JWT token that you can use to authenticate the user."
                    },
                    "expire": {
                      "type": "string",
                      "description": "Expiration time of the JWT token."
                    },
                    "external_user_id": {
                      "type": "string",
                      "description": "Identifier of the user in Brewit."
                    }
                  },
                  "required": ["token", "expire", "external_user_id"]
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Use your Brewit [API_KEY](/api-reference/introduction#api-keys) as the value of this header."
      }
    }
  }
}
