# space.highport.manage.grantSpaceAccess

> Published by [lexicons.highport.space](https://lexicon.garden/identity/did:plc:ciygg5hma4q7ah2kxaszkyob)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:ciygg5hma4q7ah2kxaszkyob/space.highport.manage.grantSpaceAccess)
- [Documentation](https://lexicon.garden/lexicon/did:plc:ciygg5hma4q7ah2kxaszkyob/space.highport.manage.grantSpaceAccess/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:ciygg5hma4q7ah2kxaszkyob/space.highport.manage.grantSpaceAccess/examples)

## Definitions

### `space.highport.manage.grantSpaceAccess`

**Type**: `procedure`

Give bard a delegation token so it can keep reading a space. Any member can call this with a token they issued. Bard trades it for a credential, renews its notification registration when due, and catches up on anything it missed.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `space` | `string` (at-uri) | Yes |  |
| `delegationToken` | `string` | Yes | A delegation token the caller minted for this space. Used once and never stored. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `drained` | `integer` | Yes | Queued notifications this grant turned into sync jobs. |
| `accessExpiresAt` | `string` (datetime) | Yes | When bard's new credential expires. |
| `registrationExpiresAt` | `string` (datetime) | No | When bard's notification registration with the space host expires. |

#### Errors

- **SpaceNotFound**: Bard is not connected to that space. Call connectSpace first.
- **GrantIssuerMismatch**: The delegation token was not issued by the caller.
- **GrantExpired**: The delegation token has expired.
- **GrantRefused**: The space host refused the exchange.
- **AppNotAllowed**: The space does not allow bard access.
- **SpacesDisabled**: Space support is disabled on this deployment.

## Raw Schema

```json
{
  "id": "space.highport.manage.grantSpaceAccess",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "space",
            "delegationToken"
          ],
          "properties": {
            "space": {
              "type": "string",
              "format": "at-uri"
            },
            "delegationToken": {
              "type": "string",
              "description": "A delegation token the caller minted for this space. Used once and never stored."
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "SpaceNotFound",
          "description": "Bard is not connected to that space. Call connectSpace first."
        },
        {
          "name": "GrantIssuerMismatch",
          "description": "The delegation token was not issued by the caller."
        },
        {
          "name": "GrantExpired",
          "description": "The delegation token has expired."
        },
        {
          "name": "GrantRefused",
          "description": "The space host refused the exchange."
        },
        {
          "name": "AppNotAllowed",
          "description": "The space does not allow bard access."
        },
        {
          "name": "SpacesDisabled",
          "description": "Space support is disabled on this deployment."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "accessExpiresAt",
            "drained"
          ],
          "properties": {
            "drained": {
              "type": "integer",
              "description": "Queued notifications this grant turned into sync jobs."
            },
            "accessExpiresAt": {
              "type": "string",
              "format": "datetime",
              "description": "When bard's new credential expires."
            },
            "registrationExpiresAt": {
              "type": "string",
              "format": "datetime",
              "description": "When bard's notification registration with the space host expires."
            }
          }
        },
        "encoding": "application/json"
      },
      "description": "Give bard a delegation token so it can keep reading a space. Any member can call this with a token they issued. Bard trades it for a credential, renews its notification registration when due, and catches up on anything it missed."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
