---
raw: true
search:
  tags:
    - Access
    - PUT
seo:
  description: >-
    Atomically replaces every editable grant dimension and… Reference for the
    PUT /v1/spaces/{spaceId}/grants/{grantId} endpoint in the Spacefast Partner
    API.
sidebar:
  label: Replace a managed space grant
  badge: PUT
title: Replace a managed space grant
type: openapi-operation
---
Atomically replaces every editable grant dimension and increments its generation. Changing capabilities or target to a commenting grant the comments surface never shows returns 422 `comments_target_unavailable`. A public audience on a Space whose team allows private spaces only returns 403 `team_private_spaces_only`.

`PUT /v1/spaces/{spaceId}/grants/{grantId}`

**Request body** (`application/json`, required)

- `name` (string)
- `audience` (object, required)
- `resources` (object, required)
- `capabilities` (string[], required)
- `constraints` (object)
- `target` (object, required)

Request body example:

```json
{
  "name": "string",
  "audience": {
    "kind": "public"
  },
  "resources": {
    "include": [
      "string"
    ],
    "exclude": []
  },
  "capabilities": [
    "page.view"
  ],
  "constraints": {},
  "target": {
    "kind": "live"
  }
}
```

**Responses**

- `200` — Response for status 200
- `default` — Problem details (RFC 9457). Any 4xx/5xx response is one \`application/problem+json\` document.

Response example, 200:

```json
{
  "$schema": "http://example.com",
  "data": {
    "grant": {
      "name": "string",
      "audience": {
        "kind": "public"
      },
      "resources": {
        "include": [
          "string"
        ],
        "exclude": []
      },
      "capabilities": [
        "page.view"
      ],
      "constraints": {},
      "target": {
        "kind": "live"
      },
      "id": "string",
      "source": {
        "kind": "config",
        "reference": "string"
      }
    },
    "generation": 1,
    "status": "scheduled",
    "sourceExplanation": {
      "editable": true,
      "label": "string",
      "detail": "string"
    },
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  },
  "operation": {
    "id": "string",
    "kind": "string",
    "status": "queued",
    "resources": [
      {
        "type": "string",
        "id": "string"
      }
    ],
    "progress": {
      "total": 0,
      "completed": 0,
      "failed": 0
    },
    "diagnostics": [
      {
        "code": "string",
        "severity": "info",
        "message": "string",
        "path": "string",
        "provider": "infra",
        "details": {
          "property1": null,
          "property2": null
        },
        "fix": "string",
        "retryable": true
      }
    ],
    "createdAt": "2019-08-24T14:15:22Z",
    "finishedAt": "2019-08-24T14:15:22Z"
  }
}
```
