> For the complete documentation index, see [llms.txt](https://docs.zumrails.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zumrails.com/api-reference/authentication.md).

# Authentication

All API requests are using the Bearer Token Authorization. A Bearer Token will last up to an hour from the time it is generated, allowing multiple API calls to be made securely without authorizing each time.

## Authenticate

Use this endpoint if you want to authenticate and generate the token.

To be able to get your token access, open the Settings page in the Portal, then navigate to the section Webhook & API settings. You will need the username and password.

`Method: POST`

`Endpoint: {{env}}/api/authorize`

{% tabs %}
{% tab title="Payload" %}

```json
{
  "Username": "abc...123",
  "Password": "xyz...321"
}
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "statusCode": 200,
    "message": "POST Request successful.",
    "isError": false,
    "result": {
        "Role": "API",
        "Token": "eyJhbG...tOTuvNvJc",
        "CustomerId": "3012...042f2",
        "CompanyName": "Test Company Inc."
        "CustomerType": "Customer",
        "Username": "b022aced-fae9-414f-853e-959fdf90d8f1"    }
}
```

{% endtab %}
{% endtabs %}

**Input parameters**

<table><thead><tr><th>Parameter</th><th width="237">Type</th><th>Description</th></tr></thead><tbody><tr><td>Username</td><td>string</td><td>Your API username</td></tr><tr><td>Password</td><td>string</td><td>Your API password</td></tr></tbody></table>

**Responses**

<table><thead><tr><th width="282.2000732421875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Role</td><td>The role this login belongs to</td></tr><tr><td>Token</td><td>The authorization token that needs to be used in any other API request</td></tr><tr><td>CustomerId</td><td>The customer id this login belongs to</td></tr><tr><td>CompanyName</td><td>The company name this login belongs to</td></tr><tr><td>CustomerType</td><td>Type for the customer account</td></tr><tr><td>Username</td><td>Username for the login</td></tr></tbody></table>

{% hint style="info" %}
**INFO**

You have to inform the Token field received in this endpoint in any other request you want to execute. Once the token expires, you have to authenticate again to be able to retrieve a new token.
{% endhint %}

## Cancel token

Use this endpoint to invalidate an active authorization token. Once canceled, the token can no longer be used for authentication or API access.

`Method: PATCH`

`Endpoint: {{env}}/api/authorize/canceltoken`

{% tabs %}
{% tab title="Response" %}

```json
{
    "statusCode": 200,
    "message": "Token cancelled",
    "isError": false
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zumrails.com/api-reference/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
