Token Canopy Viewer Sessions API
The viewer-sessions API from Token Canopy, for viewer-sessions.
The viewer-sessions API from Token Canopy, for viewer-sessions.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/tokencanopy-com:tokencanopy-com-viewer-sessions-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: AgentDrive Viewer Sessions API
description: 'AgentDrive is an agent-focused artifact store: drive-scoped folders, artifacts, and immutable versions, with local grants, possession-based share links, drive-scoped search, and a cursor-resumable change feed. Bearer-authenticated with Hub-issued product tokens (see /.well-known/oauth-protected-resource); every mutation takes an Idempotency-Key, and existing-state mutations take If-Match.'
version: 0.0.1
servers:
- url: https://drive.tokencanopy.com
description: This deployment
- url: http://127.0.0.1:8000
description: Local dev
tags:
- name: viewer-sessions
paths:
/v0/drives/{drive_id}/artifacts/{artifact_id}/viewer-sessions:
post:
tags:
- viewer-sessions
summary: Create Viewer Session
description: 'Mint a viewer session pinned to one immutable version. The response
carries the plaintext credential — the only response that does — and is
never cacheable.'
operationId: viewer_sessions_create
parameters:
- name: drive_id
in: path
required: true
schema:
type: string
title: Drive Id
- name: artifact_id
in: path
required: true
schema:
type: string
title: Artifact Id
- name: Idempotency-Key
in: header
required: true
schema:
anyOf:
- type: string
- type: 'null'
title: Idempotency-Key
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
deprecated: true
description: 'Deprecated: redundant with the operation''s `bearerAuth` security requirement, which is how a generated client should learn to authenticate. Scheduled for removal.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ViewerSessionCreateIn'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ViewerSessionCreateOut'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
'422':
description: Request validation failed.
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationErrorResponse'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
'404':
description: The parent or target resource was not found or is not visible.
content:
application/json:
schema:
$ref: '#/components/schemas/V0ErrorEnvelope'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
'409':
description: A sibling already occupies the name/path, or the idempotency key was reused for a different request.
content:
application/json:
schema:
$ref: '#/components/schemas/V0ErrorEnvelope'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
'503':
description: 'The private viewer is not enabled on this deployment (VIEWER_DISABLED — fail closed, no fallback, and no Retry-After: operator enablement has no honest client retry time), or token verification is temporarily unavailable (the generic auth-unavailability 503, which does carry Retry-After).'
content:
application/json:
schema:
$ref: '#/components/schemas/V0ErrorEnvelope'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
Retry-After:
description: Seconds until the caller should retry.
schema:
type: integer
minimum: 0
'401':
description: Missing or invalid bearer token.
content:
application/json:
schema:
$ref: '#/components/schemas/V0ErrorEnvelope'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
WWW-Authenticate:
description: RFC 6750 bearer authentication challenge.
schema:
type: string
'403':
description: Token lacks a required scope.
content:
application/json:
schema:
$ref: '#/components/schemas/V0ErrorEnvelope'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
'429':
description: Rate limited.
content:
application/json:
schema:
$ref: '#/components/schemas/V0ErrorEnvelope'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
Retry-After:
description: Seconds until the caller should retry.
schema:
type: integer
minimum: 0
'400':
description: Malformed request (invalid query parameter, cursor, or argument).
content:
application/json:
schema:
$ref: '#/components/schemas/V0ErrorEnvelope'
headers:
X-Request-Id:
description: Request correlation identifier.
schema:
type: string
security:
- bearerAuth: []
x-required-scopes:
- content:read
x-stability-level: beta
components:
schemas:
ViewerSessionCreateOut:
properties:
id:
type: string
pattern: ^vwr_[a-f0-9]{16}$
title: Id
drive_id:
type: string
pattern: ^drv_[a-f0-9]{16}$
title: Drive Id
artifact_id:
type: string
pattern: ^art_[a-f0-9]{16}$
title: Artifact Id
version_id:
type: string
pattern: ^ver_[a-f0-9]{16}$
title: Version Id
expires_at:
type: string
format: date-time
title: Expires At
created_at:
type: string
format: date-time
title: Created At
expires_in:
type: integer
title: Expires In
description: Seconds until the session expires, from mint time.
credential:
anyOf:
- type: string
- type: 'null'
title: Credential
description: Plaintext viewer credential. Present only on first execution of a mint; null on idempotent replay — mint a new session with a fresh Idempotency-Key to obtain a credential.
type: object
required:
- id
- drive_id
- artifact_id
- version_id
- expires_at
- created_at
- expires_in
title: ViewerSessionCreateOut
description: 'The mint response — the ONLY response carrying the plaintext viewer
credential. The credential authorizes the isolated viewer host''s
`/view/doc` and `/view/content` for this one pinned version, via an
Authorization header only — it must never be placed in a URL, cookie,
or persistent storage.'
V0ErrorEnvelope:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
description: Stable machine-readable error code (see the error-catalog).
enum:
- ARTIFACT_NOT_FOUND
- ARTIFACT_PATH_CONFLICT
- ARTIFACT_TOO_LARGE
- AUTHENTICATION_REQUIRED
- AUTH_UNAVAILABLE
- BAD_REQUEST
- BANDWIDTH_LIMIT_EXCEEDED
- CHANGE_CURSOR_EXPIRED
- CHECKSUM_MISMATCH
- CONFLICT
- DOWNLOAD_SIGNING_UNAVAILABLE
- DRIVE_LIMIT_EXCEEDED
- DRIVE_NOT_FOUND
- FOLDER_NOT_FOUND
- FOLDER_PATH_CONFLICT
- FOLDER_RECURSIVE_REQUIRED
- GRANT_CONFLICT
- GRANT_NOT_FOUND
- GRANT_PERMANENT
- IDEMPOTENCY_CONFLICT
- IDEMPOTENCY_IN_PROGRESS
- IDEMPOTENCY_KEY_REQUIRED
- INTERNAL_ERROR
- INVALID_ARGUMENT
- INVALID_CURSOR
- INVALID_PARAMETER
- INVALID_QUERY
- INVALID_REQUEST
- METHOD_NOT_ALLOWED
- NAME_CONFLICT
- NOT_ACCEPTABLE
- NOT_AUTHORIZED
- NOT_FOUND
- OBJECT_METADATA_MISMATCH
- OBJECT_SIZE_MISMATCH
- PAYLOAD_TOO_LARGE
- PERMISSION_DENIED
- PRECONDITION_FAILED
- PRECONDITION_REQUIRED
- RATE_LIMITED
- SEARCH_MODE_UNAVAILABLE
- SHARE_NOT_FOUND
- SHEET_EDIT_LIMIT_EXCEEDED
- SHEET_NOT_FOUND
- SHEET_SESSION_ALREADY_COMPLETED
- SHEET_SESSION_EXPIRED
- SHEET_SESSION_NOT_FOUND
- SUBTREE_TOO_LARGE
- TRANSFER_DISABLED
- TRANSFER_LIMIT_EXCEEDED
- TRANSFER_UNAVAILABLE
- UNSUPPORTED_MEDIA_TYPE
- UPLOAD_ALREADY_COMPLETED
- UPLOAD_BUSY
- UPLOAD_EXPIRED
- UPLOAD_INCOMPLETE
- UPLOAD_NOT_COMPLETABLE
- VALIDATION_ERROR
- VERSION_NOT_FOUND
- VIEWER_DISABLED
- VIEWER_SESSION_NOT_FOUND
- WORKBOOK_NOT_EDITABLE
- WORKBOOK_TOO_LARGE
- WORKBOOK_UNPARSEABLE
message:
type: string
details:
type: object
description: Error-code-specific context (optional).
additionalProperties: true
ViewerSessionCreateIn:
properties:
version_id:
anyOf:
- type: string
pattern: ^ver_[a-f0-9]{16}$
- type: 'null'
title: Version Id
additionalProperties: false
type: object
title: ViewerSessionCreateIn
description: 'POST /v0/drives/{id}/artifacts/{id}/viewer-sessions body.
``version_id`` omitted (or null) pins the artifact''s CURRENT head at
mint time; the session never follows the head afterwards.'
ValidationErrorResponse:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
message:
type: string
details:
type: object
properties:
fields:
type: array
items:
type: object
properties:
location:
type: string
reason:
type: string
additionalProperties: true
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: 'Hub-issued bearer token. Scopes: drives:*, content:*, sharing:*, changes:read, usage:read. See the OAuth-protected-resource discovery document (RFC 9728).'
x-agentdrive-compatibility-policy: 2