# Authentication

## via API Key

> To authenticate to the API, a JWT request token is encoded and sent as the \`jwt\` param in a \`POST\` to \`/auth/token\`.  The \`access\_token\` in the response is the JWT bearer token that is included as the \`Authorization\` value in the \`Header\` of all subsequent API calls.\
> \
> If you do not have a NETOSECRET API key, see \[Create a Netography API Key]\(<https://docs.netography.com/api-reference/create-a-netography-api-key>). The NETOSECRET string is a base64 encoded JSON string that contains the secrets needed to construct a JWT request token.  It is NOT a JWT request token itself -- you must generate it from that value.\
> \
> \## Generating a JWT request token in code\
> \[Create a JWT Request Token]\(<https://docs.netography.com/api-recipes/recipes/create-a-jwt-request-token>). \
> \
> \> To authenticate to the API on this page, you need to copy the token string from the \_JWT Request Token\_ field directly above, and paste it into the \_jwt\_ field directly below.<br>

```json
{"openapi":"3.0.0","info":{"title":"Netography APIs","version":"1.0"},"tags":[{"name":"Authentication"}],"servers":[{"url":"https://api.netography.com","description":"Netography API"}],"security":[],"paths":{"/api/v1/auth/token":{"post":{"operationId":"v1_auth_token_post","tags":["Authentication"],"requestBody":{"required":true,"description":"A JSON request body with the key `jwt`.","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"jwt":{"type":"string","description":"A JWT token encoded using your Accounts API Key Shared Secret."}},"required":["jwt"]}}}},"summary":"via API Key","description":"To authenticate to the API, a JWT request token is encoded and sent as the `jwt` param in a `POST` to `/auth/token`.  The `access_token` in the response is the JWT bearer token that is included as the `Authorization` value in the `Header` of all subsequent API calls.\n\nIf you do not have a NETOSECRET API key, see [Create a Netography API Key](https://docs.netography.com/api-reference/create-a-netography-api-key). The NETOSECRET string is a base64 encoded JSON string that contains the secrets needed to construct a JWT request token.  It is NOT a JWT request token itself -- you must generate it from that value.\n\n## Generating a JWT request token in code\n[Create a JWT Request Token](https://docs.netography.com/api-recipes/recipes/create-a-jwt-request-token). \n\n> To authenticate to the API on this page, you need to copy the token string from the _JWT Request Token_ field directly above, and paste it into the _jwt_ field directly below.\n","responses":{"200":{"description":"A JSON object which contains the `access_token` to use in all subsequent calls to the API","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"access_token":{"type":"string","description":"Access Token (JWT)","readOnly":true},"expires_in":{"type":"integer","description":"Seconds until the Access Token expires","readOnly":true},"refresh_expires_in":{"type":"integer","description":"Seconds until the Refresh Token expires","readOnly":true},"refresh_token":{"type":"string","description":"Refresh Token (JWT)","readOnly":true},"token_type":{"type":"string","description":"Type of JWT token.  Will always be \"bearer\"","readOnly":true},"id_token":{"type":"string","description":"ID Token (JWT)","readOnly":true},"not-before-policy":{"type":"integer","description":"Seconds until the Token will be considered valid.  Will always be 0 (now).","readOnly":true},"session-state":{"type":"string","description":"Unique Session ID","readOnly":true},"scope":{"type":"string","description":"Application Scopes","readOnly":true}}}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"type":"object","required":["status","name","message"],"additionalProperties":false,"properties":{"status":{"description":"API response code: \n  * 4xx - you did something dumb\n  * 5xx - we did something dumb\n","type":"integer","readOnly":true,"format":"int32"},"name":{"description":"They type of error","type":"string","readOnly":true},"message":{"description":"description of the error","type":"string","readOnly":true}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"allOf":[{"type":"object","required":["status","name","message"],"additionalProperties":false,"properties":{"status":{"description":"API response code: \n  * 4xx - you did something dumb\n  * 5xx - we did something dumb\n","type":"integer","readOnly":true,"format":"int32"},"name":{"description":"They type of error","type":"string","readOnly":true},"message":{"description":"description of the error","type":"string","readOnly":true}}},{"type":"object","properties":{"status":{},"name":{},"message":{}}}]}}}},"default":{"description":"Unknown Error Occurred","content":{"application/json":{"schema":{"type":"object","required":["status","name","message"],"additionalProperties":false,"properties":{"status":{"description":"API response code: \n  * 4xx - you did something dumb\n  * 5xx - we did something dumb\n","type":"integer","readOnly":true,"format":"int32"},"name":{"description":"They type of error","type":"string","readOnly":true},"message":{"description":"description of the error","type":"string","readOnly":true}}}}}}}}}}}
```

## via User Credentials

> Obtain an \`access\_token\` via User Credentials

```json
{"openapi":"3.0.0","info":{"title":"Netography APIs","version":"1.0"},"tags":[{"name":"Authentication"}],"servers":[{"url":"https://api.netography.com","description":"Netography API"}],"security":[],"paths":{"/api/auth/bearer/token":{"post":{"operationId":"auth_bearer_token_post","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","additionalProperties":false,"properties":{"username":{"type":"string"},"password":{"type":"string","format":"password"}},"required":["username","password"]}}}},"summary":"via User Credentials","description":"Obtain an `access_token` via User Credentials","responses":{"200":{"description":"A JSON object which contains the `access_token` to use in all subsequent calls to the API","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"access_token":{"type":"string","description":"Access Token (JWT)","readOnly":true},"expires_in":{"type":"integer","description":"Seconds until the Access Token expires","readOnly":true},"refresh_expires_in":{"type":"integer","description":"Seconds until the Refresh Token expires","readOnly":true},"refresh_token":{"type":"string","description":"Refresh Token (JWT)","readOnly":true},"token_type":{"type":"string","description":"Type of JWT token.  Will always be \"bearer\"","readOnly":true},"id_token":{"type":"string","description":"ID Token (JWT)","readOnly":true},"not-before-policy":{"type":"integer","description":"Seconds until the Token will be considered valid.  Will always be 0 (now).","readOnly":true},"session-state":{"type":"string","description":"Unique Session ID","readOnly":true},"scope":{"type":"string","description":"Application Scopes","readOnly":true}}}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"type":"object","required":["status","name","message"],"additionalProperties":false,"properties":{"status":{"description":"API response code: \n  * 4xx - you did something dumb\n  * 5xx - we did something dumb\n","type":"integer","readOnly":true,"format":"int32"},"name":{"description":"They type of error","type":"string","readOnly":true},"message":{"description":"description of the error","type":"string","readOnly":true}}}}}},"default":{"description":"Unknown Error Occurred","content":{"application/json":{"schema":{"type":"object","required":["status","name","message"],"additionalProperties":false,"properties":{"status":{"description":"API response code: \n  * 4xx - you did something dumb\n  * 5xx - we did something dumb\n","type":"integer","readOnly":true,"format":"int32"},"name":{"description":"They type of error","type":"string","readOnly":true},"message":{"description":"description of the error","type":"string","readOnly":true}}}}}}}}}}}
```

## via Refresh Token

> Obtain a new \`access\_token\` via a \`refresh\_token\`

```json
{"openapi":"3.0.0","info":{"title":"Netography APIs","version":"1.0"},"tags":[{"name":"Authentication"}],"servers":[{"url":"https://api.netography.com","description":"Netography API"}],"security":[],"paths":{"/api/auth/bearer/refresh":{"post":{"operationId":"auth_bearer_refresh_post","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","additionalProperties":false,"properties":{"refresh_token":{"type":"string"}},"required":["refresh_token"]}}}},"summary":"via Refresh Token","description":"Obtain a new `access_token` via a `refresh_token`","responses":{"200":{"description":"A JSON object which contains the `access_token` to use in all subsequent calls to the API","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"access_token":{"type":"string","description":"Access Token (JWT)","readOnly":true},"expires_in":{"type":"integer","description":"Seconds until the Access Token expires","readOnly":true},"refresh_expires_in":{"type":"integer","description":"Seconds until the Refresh Token expires","readOnly":true},"refresh_token":{"type":"string","description":"Refresh Token (JWT)","readOnly":true},"token_type":{"type":"string","description":"Type of JWT token.  Will always be \"bearer\"","readOnly":true},"id_token":{"type":"string","description":"ID Token (JWT)","readOnly":true},"not-before-policy":{"type":"integer","description":"Seconds until the Token will be considered valid.  Will always be 0 (now).","readOnly":true},"session-state":{"type":"string","description":"Unique Session ID","readOnly":true},"scope":{"type":"string","description":"Application Scopes","readOnly":true}}}}}},"400":{"description":"Wrong or expired refresh token, or user/api-key removed","content":{"application/json":{"schema":{"type":"object","required":["status","name","message"],"additionalProperties":false,"properties":{"status":{"description":"API response code: \n  * 4xx - you did something dumb\n  * 5xx - we did something dumb\n","type":"integer","readOnly":true,"format":"int32"},"name":{"description":"They type of error","type":"string","readOnly":true},"message":{"description":"description of the error","type":"string","readOnly":true}}}}}},"default":{"description":"Unknown Error Occurred","content":{"application/json":{"schema":{"type":"object","required":["status","name","message"],"additionalProperties":false,"properties":{"status":{"description":"API response code: \n  * 4xx - you did something dumb\n  * 5xx - we did something dumb\n","type":"integer","readOnly":true,"format":"int32"},"name":{"description":"They type of error","type":"string","readOnly":true},"message":{"description":"description of the error","type":"string","readOnly":true}}}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fusion.vectra.ai/api-reference/netography-apis/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
