---
title: "Obtain Access Token"
method: POST
path: "/oauth2/token"
tags: ["Authentication"]
---

# Obtain Access Token

`POST /oauth2/token`

Exchanges a client ID and client secret for a temporary access token needed for calling Security Onion Connect API methods.
The client ID and client secret are provided within the SOC Administration -> API Clients screen, when creating a new API client or when regenerating an API client's secret.
The client secrets are only temporarily visible during those two specific times.
The returned access token will expire within 1-2 hours, by default. Ensure the custom integration application is capable of exchanging for a new access token prior to the expiration.

## Response `200`

The access token response object.

- ServerAccessTokenResponse
  - `access_token` string — The access token to be used for all other Connect API requests."
  - `expires_in` integer — Amount of time, in seconds, before the access token expires."
  - `scope` string — Scope will be blank due to the use of application-level RBAC for authorization.
  - `token_type` string — Token type will always be 'bearer' for access token exchanges.

## Other responses

- `400` — Missing basic authorization credentials or missing grant_type form parameter in request body
- `401` — Invalid client credentials
- `500` — Internal error; review Hydra logs

---

[API](https://skmtc.net/security-onion-solutions/apis/security-onion-connect-api.md) · [All operations](https://skmtc.net/security-onion-solutions/apis/security-onion-connect-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/security-onion-solutions/security-onion-connect-api/versions/0576ce393f8d/schema)
