> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Authenticate Access Token (Local)

> Authenticate a Connected App access token.

Examine and introspect an access token locally. All standard and custom claims will be returned. No network calls are made when invoking this API method.

An error will be thrown if the token is not active.

This method supports **only** [access tokens](https://stytch.com/docs/api-reference/consumer/api/connected-apps/tokens/connected-app-access-token-object.md).

If an `authorization_check` object is passed in, this method will also check if the token contains scopes that are authorized to perform the specified action on the `resource_id` in the specified Organization.

## Body

**token** `string` *required*

The token to introspect.

**authorization\_check** `object`

If an `authorization_check` object is passed in, this method will also check if the Member is authorized to perform the given action on the given Resource in the specified Organization. A Member is authorized if their Member Session contains a Role, assigned [explicitly or implicitly](https://stytch.com/docs/multi-tenant-authentication/guides/rbac/role-assignment), with adequate permissions. In addition, the `organization_id` passed in the authorization check must match the Member's Organization.

The Roles on the Member Session may differ from the Roles you see on the Member object - Roles that are implicitly assigned by SSO connection or SSO group will only be valid for a Member Session if there is at least one authentication factor on the Member Session from the specified SSO connection.

If the Member is not authorized to perform the specified action on the specified Resource, or if the `organization_id` does not match the Member's Organization, a 403 error will be thrown. Otherwise, the response will contain a list of Roles that satisfied the authorization check.

**organization\_id** `string`

Globally unique UUID that identifies a specific Organization. The Organization's ID must match the Member's Organization.
**resource\_id** `string`

A unique identifier of the RBAC Resource, provided by the developer and intended to be human-readable. A `resource_id` is not allowed to start with `stytch`, which is a special prefix used for Stytch default Resources with reserved `resource_id`s. These include `stytch.organization`, `stytch.member`, `stytch.sso`, and `stytch.self`. Check out the [guide on Stytch default Resources](https://stytch.com/docs/multi-tenant-auth/enterprise-ready/rbac/create-rbac-policy.md#default-roles-and-resources) for a more detailed explanation.
**action** `string`

An action to take on a Resource.

## Response

**scope** `string`

The scopes granted to the token.

**token\_type** `string`

The type of the token. Possible values are `access_token` and `refresh_token`.

**expires\_at** `string`

The expiration time of the token, expressed as a Unix timestamp.

**issued\_at** `string`

The time at which the token was issued, expressed as a Unix timestamp.

**subject** `string`

The subject of the token. This is a unique identifier for the user.

**issuer** `string`

The issuer of the token. This is the domain of your project, e.g. https\://\$ by default, or stytch.com/PROJECT\_ID if the token was retrieved using the stytch.com domain. See the [Custom Domain](https://stytch.com/docs/connected-apps/resources/custom-domains.md) guide for more information.

**audience** `string`

The audience (project\_id) that the token is intended for. Additional custom audiences can be defined for the token by setting the `access_token_custom_audience` parameter on the client object.

```js Node SDK theme={null}
const stytch = require('stytch');

const client = new stytch.B2BClient({
  project_id: '${projectId}',
  secret: '${secret}',
  custom_base_url: '${projectDomain}',
});

const params = {
  token: 'eyJ...',
};

const options = {
  authorization_check: {
    organization_id: '${organizationId}',
    resource_id: 'documents',
    action: 'create',
  },
};

client.idp
  .introspectTokenLocal(params, options)
  .then((resp) => {
    console.log(resp);
  })
  .catch((err) => {
    console.log(err);
  });

```

```go Go SDK theme={null}
package main

import (
	"context"
	"log"

	"github.com/stytchauth/stytch-go/v16/stytch/b2b/b2bstytchapi"
	"github.com/stytchauth/stytch-go/v16/stytch/b2b/idp"
)

func main() {
	client, err := b2bstytchapi.NewClient(
		"${projectId}",
		"${secret}",
		b2bstytchapi.WithBaseURI("${projectDomain}"),
	)
	if err != nil {
		log.Fatalf("error instantiating client: %v", err)
	}

	resp, err := client.IDP.IntrospectTokenLocal(context.Background(), &idp.IntrospectTokenLocalParams{
		Token: "eyJ...",
	})
	if err != nil {
		log.Fatalf("error in method call: %v", err)
	}

	log.Println(resp)
}
```

```python Python SDK theme={null}
from stytch import B2BClient
from stytch.b2b.models.sessions import AuthorizationCheck

client = B2BClient(
    project_id="${projectId}",
    secret="${secret}",
    custom_base_url="${projectDomain}",
)

resp = client.idp.introspect_token_local(
    token="eyJ...",
    authorization_check=AuthorizationCheck(
      organization_id='${organizationId}',
      resource_id='documents',
      action='create'
    ),
)

print(resp)

```

```ruby Ruby SDK theme={null}
require 'stytch'

client = StytchB2B::Client.new(
  project_id: '${projectId}',
  secret: '${secret}',
  custom_base_url: '${projectDomain}',
)

resp = client.idp.introspect_token_local(
    token="eyJ...",
)

print(resp)

```

```json 200 theme={null}
{
  "subject": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
  "scope": "openid email profile",
  "audience": ["PROJECT_ID"],
  "client_id": "connected-app-test-d731954d-dab3-4a2b-bdee-07f3ad1be888",
  "expires_at": 1738848103,
  "issued_at": 1738844503,
  "issuer": "https://${projectDomain}",
  "token_type": "access_token"
}
```
