---
agentTools:
  projectIndex: https://mk-bank.readme.io/llms.txt
---

# Authenticate

This endpoint is used for authenticating the API requests. It issues an access token that should be included in the headers of subsequent API calls for authorization.

> ➡️ Heads up!
>
> The issued token will have a lifetime of **60 minutes**. The partner must pay attention to the **expires\_in** property to implement its cache and token renewal strategy. It is extremely important that the token is used throughout its lifetime, and that another one is issued **only after the one that has already been generated has expired**.

**RESPONSE**

* **Token:** The access token generated to authorize subsequent API calls. This token must be included in the request headers as "Authorization: Bearer {your\_access\_token}".
* **expires\_in:** The lifespan of the token in seconds. In this example, the value is 3600 seconds, which corresponds to 1 hour. After this period, the token will expire, and a new token will need to be generated.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "MK Bank Account API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://core-h.mkbank.com.br/api"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/auth": {
      "post": {
        "summary": "Authenticate",
        "description": "This endpoint is used for authenticating the API requests. It issues an access token that should be included in the headers of subsequent API calls for authorization.",
        "operationId": "authenticating",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "key",
                  "secret"
                ],
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "API key"
                  },
                  "secret": {
                    "type": "string",
                    "description": "API Secret"
                  }
                }
              },
              "examples": {
                "Request Example": {
                  "value": {
                    "key": "123456",
                    "secret": "asdasdas"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n\t\t\"token\" => \"777777\",\n    \"expires_in\" => 3600\n}"
                  }
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"message\": \"Senha incorreta. Ap￳s 3 tentativas seu acesso ser￡ bloqueado.\",\n    \"code\": \"INVALID_CREDENTIALS\",\n    \"data\": []\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Senha incorreta. Ap￳s 3 tentativas seu acesso ser￡ bloqueado."
                    },
                    "code": {
                      "type": "string",
                      "example": "INVALID_CREDENTIALS"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "422",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"message\": \"O campo secret ￩ obrigat￳rio.\",\n    \"errors\": {\n        \"secret\": [\n            \"O campo secret ￩ obrigat￳rio.\"\n        ]\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "O campo secret ￩ obrigat￳rio."
                    },
                    "errors": {
                      "type": "object",
                      "properties": {
                        "secret": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "O campo secret ￩ obrigat￳rio."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "security": []
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "6297b52a229a9b00142bff3c:6297b691643c2e00139a9b8d"
}
```