---
agentTools:
  projectIndex: https://nexaflow.readme.io/llms.txt
---

# API for authentication

This API can be used for whole authentication flow for any kind of application.
Use Cases:
1. To generate OTP : We will send an OTP to the provided email and the same will be provided in API response.
2. To register User : We will store the user data which is provided in request body. (Email field is required) 
3. To login User : We will verify the user data and send a jwt token if verification is successful.
Note : OTP generation is rate limited API. (1 request/min)

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "description": "This is the documentation for the CMS API",
    "version": "1.0.0",
    "title": "CMS Documentation"
  },
  "tags": [
    {
      "name": "authentication",
      "description": "Authentication APIs"
    }
  ],
  "paths": {
    "/auth/{id}": {
      "post": {
        "tags": [
          "authentication"
        ],
        "summary": "API for authentication",
        "description": "This API can be used for whole authentication flow for any kind of application.\nUse Cases:\n1. To generate OTP : We will send an OTP to the provided email and the same will be provided in API response.\n2. To register User : We will store the user data which is provided in request body. (Email field is required) \n3. To login User : We will verify the user data and send a jwt token if verification is successful.\nNote : OTP generation is rate limited API. (1 request/min)\n",
        "operationId": "authentication",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Credential id given by the platform",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "This query determines what the API should do.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "otp",
                "register",
                "login"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          },
          "description": "Request body. The required properties and their types depend on the `type` query parameter:\n- `type=otp`: Required properties: `email` (string).\n- `type=register`: Required properties: `email` (string), `otp` (string). Additional properties are allowed.\n- `type=login`: Required properties: `email` (string), `otp` (string).\n",
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      }
    }
  },
  "externalDocs": {
    "description": "Find out more about Swagger",
    "url": "http://swagger.io"
  },
  "servers": [
    {
      "url": "https://api.nexaflow.xyz/api"
    }
  ],
  "components": {
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 100,
      "1": 95,
      "2": 49,
      "3": 0,
      "4": 6,
      "5": 159,
      "6": 138,
      "7": 0,
      "8": 30,
      "9": 188,
      "10": 93,
      "11": 185
    }
  }
}
```