---
title: Generate a Bearer Token
slug: monoova-onboarding-api/generate-a-bearer-token
createdAt: 2026-08-12T05:53:35.435Z
---

{
  "id": "zTgyXvIaaIdKPetxeWpQ8",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://sand-api.monoova.com/au/security/oauth-v1/token",
    "servers": [
      {
        "url": "https://sand-api.monoova.com/au/security/oauth-v1/token",
        "description": "Sandbox URL"
      },
      {
        "url": "https://api.monoova.com/au/security/oauth-v1/token",
        "description": "Production URL"
      }
    ],
    "name": "Generate a Bearer Token",
    "description": "<p>Bearer tokens are used for authentication when calling endpoints. These are short-lived tokens that expire after 24 hours. The basic authentication used when calling the Generate a Bearer Token endpoint is slightly different to other endpoints. You will need to supply both the username and password parameters when authenticating:Username: your mAccount number.Password: your API key. You can obtain both from the Monoova portal. After 10 failed authentication attempts, your account is blocked. To unlock your account, roll your API key in the Monoova portal. Rolling your API key affects your existing API integration, so you need to update the API key across your environment.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "basicAuth",
          "name": "basicAuth",
          "kind": "optional",
          "type": "http",
          "description": "<p>To authenticate using basic authentication, pass your mAccount number as the username and your API key as the password.</p>",
          "scheme": "basic"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>OK. Returns the bearer token. Pass it in the Authorization header as Bearer &#x3C;token> when you call the endpoints.</p>",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "<p>Bad Request. The request is invalid. Check errors for details.</p>",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Unauthorized. Authentication failed because the mAccount number or API key is missing or incorrect.          ",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "Internal Server Error. An unexpected error occurred. Try again later and contact Monoova support if the problem persists.",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://sand-api.monoova.com/au/security/oauth-v1/token \\\n     --header 'accept: application/json'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://sand-api.monoova.com/au/security/oauth-v1/token\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://sand-api.monoova.com/au/security/oauth-v1/token\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://sand-api.monoova.com/au/security/oauth-v1/token\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK. Returns the bearer token. Pass it in the Authorization header as Bearer &#x3C;token> when you call the endpoints.\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request. The request is invalid. Check errors for details.\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized. Authentication failed because the mAccount number or API key is missing or incorrect.\n"
        },
        {
          "id": "response-3-500",
          "language": "500",
          "code": "// Internal Server Error. An unexpected error occurred. Try again later and contact Monoova support if the problem persists.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}