Skip to content

Commit 46bea8a

Browse files
feat: provide more context for policy schema
1 parent 53e3b18 commit 46bea8a

21 files changed

Lines changed: 216 additions & 406 deletions

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 107
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/keycard%2Fkeycard-api-e0b7b296f7b0cac79675a790974f3ad90eb46833027467ee97c3ed21675628b8.yml
3-
openapi_spec_hash: 5e60faefb18dd2fca721f14252ab907a
4-
config_hash: a411a6a5bb4519b00f84eef745a194b3
1+
configured_endpoints: 106
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/keycard%2Fkeycard-api-2052af02ac981a44897f047d65dcc9e7a7643c8b2168dd73969ef94ec3d56948.yml
3+
openapi_spec_hash: ed47ef3c3f1aed86c2cb1ff009d60483
4+
config_hash: 8fdc6a9c1185417459f79052b1222ff0

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ and offers both synchronous and asynchronous clients powered by [httpx](https://
99

1010
It is generated with [Stainless](https://www.stainless.com/).
1111

12-
## MCP Server
13-
14-
Use the Keycard API MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
15-
16-
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40keycardai%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBrZXljYXJkYWkvYXBpLW1jcCJdLCJlbnYiOnsiS0VZQ0FSRF9BUElfQVBJX0tFWSI6Ik15IEFQSSBLZXkiLCJLRVlDQVJEX0FQSV9DTElFTlRfSUQiOiJNeSBDbGllbnQgSUQiLCJLRVlDQVJEX0FQSV9DTElFTlRfU0VDUkVUIjoiTXkgQ2xpZW50IFNlY3JldCJ9fQ)
17-
[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40keycardai%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40keycardai%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22KEYCARD_API_API_KEY%22%3A%22My%20API%20Key%22%2C%22KEYCARD_API_CLIENT_ID%22%3A%22My%20Client%20ID%22%2C%22KEYCARD_API_CLIENT_SECRET%22%3A%22My%20Client%20Secret%22%7D%7D)
18-
19-
> Note: You may need to set environment variables in your MCP client.
20-
2112
## Documentation
2213

2314
The REST API documentation can be found on [docs.keycard.ai](https://docs.keycard.ai). The full API of this library can be found in [api.md](api.md).

api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ from keycardai_api.types import (
88
PageInfoPagination,
99
Zone,
1010
ZoneListResponse,
11-
ZoneListSessionResourceAccessResponse,
1211
)
1312
```
1413

@@ -19,7 +18,6 @@ Methods:
1918
- <code title="patch /zones/{zoneId}">client.zones.<a href="./src/keycardai_api/resources/zones/zones.py">update</a>(zone_id, \*\*<a href="src/keycardai_api/types/zone_update_params.py">params</a>) -> <a href="./src/keycardai_api/types/zone.py">Zone</a></code>
2019
- <code title="get /zones">client.zones.<a href="./src/keycardai_api/resources/zones/zones.py">list</a>(\*\*<a href="src/keycardai_api/types/zone_list_params.py">params</a>) -> <a href="./src/keycardai_api/types/zone_list_response.py">ZoneListResponse</a></code>
2120
- <code title="delete /zones/{zoneId}">client.zones.<a href="./src/keycardai_api/resources/zones/zones.py">delete</a>(zone_id) -> None</code>
22-
- <code title="get /zones/{zoneId}/session-resource-access">client.zones.<a href="./src/keycardai_api/resources/zones/zones.py">list_session_resource_access</a>(zone_id, \*\*<a href="src/keycardai_api/types/zone_list_session_resource_access_params.py">params</a>) -> <a href="./src/keycardai_api/types/zone_list_session_resource_access_response.py">ZoneListSessionResourceAccessResponse</a></code>
2321

2422
## Applications
2523

src/keycardai_api/resources/zones/policies/versions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def create(
6868
Create a new immutable policy version
6969
7070
Args:
71+
schema_version: Schema version to validate this policy against. Must not be archived.
72+
7173
cedar_json: Cedar policy in JSON representation. Mutually exclusive with cedar_raw.
7274
7375
cedar_raw: Cedar policy in human-readable Cedar syntax. Mutually exclusive with cedar_json.
@@ -348,6 +350,8 @@ async def create(
348350
Create a new immutable policy version
349351
350352
Args:
353+
schema_version: Schema version to validate this policy against. Must not be archived.
354+
351355
cedar_json: Cedar policy in JSON representation. Mutually exclusive with cedar_raw.
352356
353357
cedar_raw: Cedar policy in human-readable Cedar syntax. Mutually exclusive with cedar_json.

src/keycardai_api/resources/zones/policy_schemas.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,22 @@
2626

2727

2828
class PolicySchemasResource(SyncAPIResource):
29-
"""Zone-scoped Cedar schema management"""
29+
"""Zone-scoped Cedar schema management.
30+
31+
The Cedar schema defines the entity model used for authorization decisions.
32+
Key entity types and their attributes:
33+
34+
- **Keycard::User** — `email` (String), `groups` (Set of String)
35+
- **Keycard::Application** — `registration_method` (RegistrationMethod entity), `credential_type` (CredentialType entity)
36+
- **Keycard::RegistrationMethod** — enum entity: `"managed"`, `"dcr"`
37+
- **Keycard::CredentialType** — enum entity: `"token"`, `"password"`, `"public-key"`, `"url"`, `"public"`
38+
- **Keycard::Resource** — `id` (String), `name` (String), `scopes` (Set of String)
39+
- **Keycard::Claims** — `email` (String), `groups` (Set of String), plus arbitrary additional fields
40+
41+
Enum-like attributes use Cedar enum entity types (schema version `2026-03-16`+).
42+
In policies, reference values as `RegistrationMethod::"managed"` or `CredentialType::"token"`.
43+
See the Credentials API spec for the full entity model reference.
44+
"""
3045

3146
@cached_property
3247
def with_raw_response(self) -> PolicySchemasResourceWithRawResponse:
@@ -243,7 +258,22 @@ def set_default(
243258

244259

245260
class AsyncPolicySchemasResource(AsyncAPIResource):
246-
"""Zone-scoped Cedar schema management"""
261+
"""Zone-scoped Cedar schema management.
262+
263+
The Cedar schema defines the entity model used for authorization decisions.
264+
Key entity types and their attributes:
265+
266+
- **Keycard::User** — `email` (String), `groups` (Set of String)
267+
- **Keycard::Application** — `registration_method` (RegistrationMethod entity), `credential_type` (CredentialType entity)
268+
- **Keycard::RegistrationMethod** — enum entity: `"managed"`, `"dcr"`
269+
- **Keycard::CredentialType** — enum entity: `"token"`, `"password"`, `"public-key"`, `"url"`, `"public"`
270+
- **Keycard::Resource** — `id` (String), `name` (String), `scopes` (Set of String)
271+
- **Keycard::Claims** — `email` (String), `groups` (Set of String), plus arbitrary additional fields
272+
273+
Enum-like attributes use Cedar enum entity types (schema version `2026-03-16`+).
274+
In policies, reference values as `RegistrationMethod::"managed"` or `CredentialType::"token"`.
275+
See the Credentials API spec for the full entity model reference.
276+
"""
247277

248278
@cached_property
249279
def with_raw_response(self) -> AsyncPolicySchemasResourceWithRawResponse:

src/keycardai_api/resources/zones/policy_sets/policy_sets.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ def create(
8181
version.
8282
8383
Args:
84+
scope_type:
85+
The scope at which this policy set applies:
86+
87+
- `"zone"` — applies to all requests in the zone.
88+
- `"resource"` — scoped to a specific resource.
89+
- `"user"` — scoped to a specific user.
90+
- `"session"` — scoped to a specific session.
91+
8492
extra_headers: Send extra headers
8593
8694
extra_query: Add additional query parameters to the request
@@ -391,6 +399,14 @@ async def create(
391399
version.
392400
393401
Args:
402+
scope_type:
403+
The scope at which this policy set applies:
404+
405+
- `"zone"` — applies to all requests in the zone.
406+
- `"resource"` — scoped to a specific resource.
407+
- `"user"` — scoped to a specific user.
408+
- `"session"` — scoped to a specific session.
409+
394410
extra_headers: Send extra headers
395411
396412
extra_query: Add additional query parameters to the request

src/keycardai_api/resources/zones/policy_sets/versions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def create(
7474
Validates the manifest, computes SHA, and creates an immutable version snapshot.
7575
7676
Args:
77+
schema_version: Schema version to pin to this policy set version.
78+
7779
extra_headers: Send extra headers
7880
7981
extra_query: Add additional query parameters to the request
@@ -478,6 +480,8 @@ async def create(
478480
Validates the manifest, computes SHA, and creates an immutable version snapshot.
479481
480482
Args:
483+
schema_version: Schema version to pin to this policy set version.
484+
481485
extra_headers: Send extra headers
482486
483487
extra_query: Add additional query parameters to the request

0 commit comments

Comments
 (0)