Skip to content

Create a delegation grant for an application or agent

POST
/v1/grants
curl --request POST \
--url https://api.trustysweep.com/v1/grants \
--header 'Content-Type: application/json' \
--cookie sweep_session=<sweep_session> \
--data '{ "principal_id": "example", "operations": [ "discover" ], "actions": [ "read_inventory" ], "sources": [ "src_01J8Z3K9M2Q4R6S8T0V2W4X6Y8" ], "containers": [ "example" ], "max_objects_per_plan": 1, "max_bytes_per_plan": 1, "max_plans_per_day": 1, "allowed_destinations": [ "dst_01J8Z3K9M2Q4R6S8T0V2W4X6Y8" ], "allow_external_destinations": false, "allow_destructive": false, "allow_automatic": false, "require_human_approval_above": "read", "min_confidence": 0.85, "commercial_ceiling_cents": 1, "expires_at": "2026-04-15T12:00:00Z", "time_window": { "start_hour_utc": 1, "end_hour_utc": 1 } }'
Idempotency-Key
string
<= 255 characters

Unique key per logical operation. Same key + same body within 24h replays the original response with Idempotent-Replayed: true; same key + different body → 409 idempotency_key_reused.

Media typeapplication/json
object
principal_id
required
string
operations
required
Array<string>
>= 1 items
Allowed values: discover preserve write remove restore migrate monitor automate billable_execute
actions
required
Array<string>
>= 1 items
Allowed values: read_inventory read_quota read_vault search_vault create_plan preserve trash restore copy move migrate_external unsubscribe monitor automate manage_grants delete_vault_object delete_account permanent_delete
sources
One of:
Array<string>
containers
One of:
Array<string>
max_objects_per_plan
integer
max_bytes_per_plan
integer
max_plans_per_day
integer
allowed_destinations
One of:
Array<string>
allow_external_destinations
boolean
allow_destructive
boolean
allow_automatic
boolean
require_human_approval_above
string
Allowed values: read low medium high critical
min_confidence
number
default: 0.85
commercial_ceiling_cents
integer
expires_at
string format: date-time
time_window
One of:
object
start_hour_utc
integer
end_hour_utc
integer

Created

Media typeapplication/json

Versioned user delegation grant constraining what a principal may do on behalf of a user.

object
id
required

Prefixed ULID (grt_…)

string
/^grt_[0-9A-HJKMNP-TV-Z]{26}$/
version
required
integer
userId
required
string
tenantId
required
string
principalId
required
string
status
required
string
Allowed values: active revoked expired
createdAt
required
string format: date-time
expiresAt
One of:
string format: date-time
revokedAt
One of:
string format: date-time
operations
required
Array<string>
Allowed values: discover preserve write remove restore migrate monitor automate billable_execute
actions
required
Array<string>
Allowed values: read_inventory read_quota read_vault search_vault create_plan preserve trash restore copy move migrate_external unsubscribe monitor automate manage_grants delete_vault_object delete_account permanent_delete
sources
One of:
Array<string>
containers
One of:
Array<string>
assetKinds
One of:
Array<string>
maxObjectsPerPlan
One of:
integer
maxBytesPerPlan
One of:
integer
maxPlansPerDay
One of:
integer
allowedDestinations
One of:
Array<string>
allowExternalDestinations
boolean
allowDestructive
boolean
allowAutomatic
boolean
requireShadowPlan
boolean
requireHumanApprovalAbove
string
Allowed values: read low medium high critical
minConfidence
number
commercialCeilingCents
One of:
integer
timeWindow
One of:
object
startHourUtc
required
integer
endHourUtc
required
integer
Example
{
"id": "grt_01J8Z3K9M2Q4R6S8T0V2W4X6Y8",
"status": "active",
"operations": [
"discover"
],
"actions": [
"read_inventory"
],
"requireHumanApprovalAbove": "read"
}
RateLimit-Limit
integer

Requests allowed in the current window.

RateLimit-Remaining
integer

Requests remaining in the current window.

RateLimit-Reset
integer

Seconds until the window resets.

Validation failed

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
title
required
string
status
required
integer
detail
string
code
required

Machine-readable error code from errors.json

string
request_id
required
string
errors
Array<object>
object
path
required
string
message
required
string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
]
}

Unauthenticated

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
title
required
string
status
required
integer
detail
string
code
required

Machine-readable error code from errors.json

string
request_id
required
string
errors
Array<object>
object
path
required
string
message
required
string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
]
}

Forbidden / action denied / step-up required

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
title
required
string
status
required
integer
detail
string
code
required

Machine-readable error code from errors.json

string
request_id
required
string
errors
Array<object>
object
path
required
string
message
required
string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
]
}

Not found

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
title
required
string
status
required
integer
detail
string
code
required

Machine-readable error code from errors.json

string
request_id
required
string
errors
Array<object>
object
path
required
string
message
required
string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
]
}

Conflict (state, stale plan, idempotency key reuse)

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
title
required
string
status
required
integer
detail
string
code
required

Machine-readable error code from errors.json

string
request_id
required
string
errors
Array<object>
object
path
required
string
message
required
string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
]
}

Rate limited

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
title
required
string
status
required
integer
detail
string
code
required

Machine-readable error code from errors.json

string
request_id
required
string
errors
Array<object>
object
path
required
string
message
required
string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
]
}
Retry-After
integer

Seconds to wait before retrying.

RateLimit-Limit
integer

Requests allowed in the current window.

RateLimit-Remaining
integer

Requests remaining in the current window.

RateLimit-Reset
integer

Seconds until the window resets.

Internal error

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
title
required
string
status
required
integer
detail
string
code
required

Machine-readable error code from errors.json

string
request_id
required
string
errors
Array<object>
object
path
required
string
message
required
string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
]
}