# `OpenPayments.Types.AccessToken`
[🔗](https://github.com/interledger/open-payments-elixir/blob/v1.0.0/lib/open_payments/types/access_token.ex#L1)

An issued resource access token returned by an authorization server.

The pinned schema requires an opaque string `value`, an absolute-URI `manage`
endpoint and an ordered typed `access` list. Optional `expires_in` is an integer;
omission becomes nil and explicit JSON null is rejected. The schema declares no
minimum or maximum for expiry integers. Additional object fields are forbidden.

Values, management URI spelling and expiry metadata are preserved. This type
checks response data without imposing the request header's token68 alphabet or
HTTP target policy. It does not track elapsed time, issue management requests,
rotate tokens or compare access to a grant request.

Inspection exposes only expiry metadata. Explicit `to_map/1` and JSON encoding
contain the token and any nested card payloads. Errors retain safe field paths.
Validate manually constructed or modified structs with `validate/1`;
`to_map/1` converts shape without validating it.

# `t`

```elixir
@type t() :: %OpenPayments.Types.AccessToken{
  access: OpenPayments.Types.Access.t(),
  expires_in: integer() | nil,
  manage: String.t(),
  value: String.t()
}
```

# `from_map`

```elixir
@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}
```

Decodes an issued token and its typed access entries.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts to protocol fields, including token/card values, without validating.

# `validate`

```elixir
@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}
```

Validates issued token fields and revalidates all typed access entries.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
