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

# Authentication and authorization

HTTP Basic authentication over HTTPS, with role-based access control.

## Authentication

Authentication uses the HTTP Basic Auth method: each request carries a header with a username and password. To prevent credentials from being sent in plain text, the server responds only to HTTPS requests.

## Authorization

The API server enforces an access control list for object access. There are several user roles (including `admin` and `viewer`), and each role's access list defines:

* Which object URLs the role can access
* Which operations on each model the role can perform
* Which model fields the role can view

## Example

{% tabs %}
{% tab title="Authenticated" %}
The header value is the Base64 encoding of `username:password`. This example encodes `admin:password`.

```http
GET /api/v2/
Authorization: Basic YWRtaW46cGFzc3dvcmQ=
```

```json
{
  "resources": {
    "collect/collection_task": { "url": "/collect/collection_task" },
    "collect_manager/collection_task_definition": { "url": "/collect_manager/collection_task_definition" },
    "events": { "url": "/events" },
    ...
  }
}
```

{% endtab %}

{% tab title="No credentials" %}

```http
GET /api/v2/
```

```html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>
```

{% 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.silk.us/api-reference/getting-started/authentication-and-authorization.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.
