> For the complete documentation index, see [llms.txt](https://docs.tiun.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tiun.io/api/product-access.md).

# Product Access

## List a user's active product access

> Returns all product and reference ID pairs the user currently has access to.

```json
{"openapi":"3.0.1","info":{"title":"Public tiun.live API documentation","version":"v1"},"servers":[{"url":"https://api.tiun.live","description":"Production"},{"url":"https://api-sandbox.tiun.live","description":"Sandbox"}],"paths":{"/live_api/s2s/v1/users/{userId}/product_access":{"get":{"tags":["ProductAccess"],"summary":"List a user's active product access","description":"Returns all product and reference ID pairs the user currently has access to.","parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}},{"name":"X-TIUN-API-KEY","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The user's active product access entries. An empty list if the user has none.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductAccessListResponseV1"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"The user does not exist for this provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ProductAccessListResponseV1":{"required":["data"],"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProductAccessResponseV1"}}},"additionalProperties":false},"ProductAccessResponseV1":{"required":["activatedAt","productId","type"],"type":"object","properties":{"productId":{"minLength":1,"type":"string"},"referenceId":{"type":"string","nullable":true},"type":{"$ref":"#/components/schemas/ProductType"},"activatedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","nullable":true}},"additionalProperties":false},"ProductType":{"enum":["Subscription","OneTime"],"type":"string"},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}}}
```

## Check whether a user has access to a product

> Returns whether the user has access and, if so, the access details.

```json
{"openapi":"3.0.1","info":{"title":"Public tiun.live API documentation","version":"v1"},"servers":[{"url":"https://api.tiun.live","description":"Production"},{"url":"https://api-sandbox.tiun.live","description":"Sandbox"}],"paths":{"/live_api/s2s/v1/users/{userId}/product_access/{productId}":{"get":{"tags":["ProductAccess"],"summary":"Check whether a user has access to a product","description":"Returns whether the user has access and, if so, the access details.","parameters":[{"name":"userId","in":"path","description":"The tiun user ID of the user to check.","required":true,"schema":{"type":"string"}},{"name":"productId","in":"path","description":"The ID of the product to check access for.","required":true,"schema":{"type":"string"}},{"name":"referenceId","in":"query","description":"Purchase reference for repeatable access. Omit for ordinary product access.","schema":{"type":"string"}},{"name":"X-TIUN-API-KEY","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The access check result. If no matching access exists, `hasAccess` is `false`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductAccessDetailResponseV1"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"The user does not exist for this provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ProductAccessDetailResponseV1":{"required":["hasAccess"],"type":"object","properties":{"hasAccess":{"type":"boolean"},"access":{"$ref":"#/components/schemas/ProductAccessResponseV1"}},"additionalProperties":false},"ProductAccessResponseV1":{"required":["activatedAt","productId","type"],"type":"object","properties":{"productId":{"minLength":1,"type":"string"},"referenceId":{"type":"string","nullable":true},"type":{"$ref":"#/components/schemas/ProductType"},"activatedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","nullable":true}},"additionalProperties":false},"ProductType":{"enum":["Subscription","OneTime"],"type":"string"},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}}}
```


---

# 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.tiun.io/api/product-access.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.
