Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions pages/spicedb/concepts/expiring-relationships.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Callout } from 'nextra/components';
import YouTube from 'react-youtube';
import { InlinePlayground } from '@/components/playground';

# Expiring Relationships

Expand All @@ -26,7 +27,7 @@ SpiceDB supports expiring relationships, which lets users define relationships t
You should evaluate the impact of clock drift in your application.
</Callout>

## Schema Use
## Schema

Expiring relationships follow a similar use to caveated subject types.
The novelty here is that users need to enable the feature using the `use` clause.
Expand All @@ -45,7 +46,7 @@ definition resource {
}
```

## API Use
## API

The expiration of a relationship is [on a per-relationship basis](https://buf.build/authzed/api/docs/63b8911ef2871c56e5048d1f40a8473f98457ca9:authzed.api.v1#authzed.api.v1.Relationship)
at write time, using `WriteRelationships` or `BulkImportRelationships` APIs.
Expand Down Expand Up @@ -73,6 +74,25 @@ WriteRelationshipsRequest {
}
```

## Playground

Set expirations on relationships in the Playground with the format `[expiration:2025-12-31T23:59:59Z]`:

```yaml
resource:r1#folder@folder:folder1[expiration:2025-12-31T23:59:59Z]
```

or specify expirations in RFC 3339 format in the `Expiration` column in the Relationship grid editor.
<br/><InlinePlayground reference="naky4PZ86uTc"/>

## zed

Use the `--expiration-time` flag to pass the expiration time of the relationship in RFC 3339 format:

```shell zed
zed relationship create resource:r1 folder folder:folder1 --expiration-time "2025-12-31T23:59:59Z"
```

## Garbage Collection

As soon as a relationship expires, it will no longer be used in permission checks.
Expand Down