# space.highport.manage.setDomainBilling

> 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.setDomainBilling)
- [Documentation](https://lexicon.garden/lexicon/did:plc:ciygg5hma4q7ah2kxaszkyob/space.highport.manage.setDomainBilling/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:ciygg5hma4q7ah2kxaszkyob/space.highport.manage.setDomainBilling/examples)

## Definitions

### `space.highport.manage.setDomainBilling`

**Type**: `procedure`

Set whose allowance a domain's traffic uses. Changing payerPolicy revokes every visitor approval on the domain, since visitors agreed to the old arrangement. The owner always pays whatever nobody else covers.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `domain` | `string` | Yes | The registered hostname. Must belong to the caller. |
| `payerPolicy` | `string` | Yes | owner: all traffic uses the owner's allowance. visitor: signed-in visitors use their own, and the owner pays for anonymous traffic and for visitors who have run out. |
| `fallbackToOwner` | `boolean` | No | Under the visitor policy: whether a visitor who has run out falls back to the owner instead of being refused. True keeps the site up when one visitor overspends. |
| `visitorCapBytes` | `integer` | No | The most any one visitor can spend here per period. Absent means only the visitor's own cap applies. |
| `ownerBudgetBytes` | `integer` | No | How many bytes of the owner's allowance this site may spend per period on readers who are not signed in. 0 requires sign-in for everything. When set, it determines payerPolicy and fallbackToOwner; when omitted, those two apply as set. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `billing` | `object` | Yes | Whose allowance a domain's traffic uses. |
| `approvalsRevoked` | `integer` | No | How many visitor approvals the policy change revoked. |

#### Errors

- **InvalidDomain**: Not a valid, non-reserved, public-suffix-safe domain. Unlike DomainNotFound, the input is not a hostname at all.
- **DomainNotFound**: No such domain, or it does not belong to the caller.
- **InvalidRequest**: payerPolicy must be owner or visitor.

## Raw Schema

```json
{
  "id": "space.highport.manage.setDomainBilling",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "domain",
            "payerPolicy"
          ],
          "properties": {
            "domain": {
              "type": "string",
              "maxLength": 253,
              "description": "The registered hostname. Must belong to the caller."
            },
            "payerPolicy": {
              "type": "string",
              "description": "owner: all traffic uses the owner's allowance. visitor: signed-in visitors use their own, and the owner pays for anonymous traffic and for visitors who have run out.",
              "knownValues": [
                "owner",
                "visitor"
              ]
            },
            "fallbackToOwner": {
              "type": "boolean",
              "default": true,
              "description": "Under the visitor policy: whether a visitor who has run out falls back to the owner instead of being refused. True keeps the site up when one visitor overspends."
            },
            "visitorCapBytes": {
              "type": "integer",
              "minimum": 0,
              "description": "The most any one visitor can spend here per period. Absent means only the visitor's own cap applies."
            },
            "ownerBudgetBytes": {
              "type": "integer",
              "minimum": 0,
              "description": "How many bytes of the owner's allowance this site may spend per period on readers who are not signed in. 0 requires sign-in for everything. When set, it determines payerPolicy and fallbackToOwner; when omitted, those two apply as set."
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "InvalidDomain",
          "description": "Not a valid, non-reserved, public-suffix-safe domain. Unlike DomainNotFound, the input is not a hostname at all."
        },
        {
          "name": "DomainNotFound",
          "description": "No such domain, or it does not belong to the caller."
        },
        {
          "name": "InvalidRequest",
          "description": "payerPolicy must be owner or visitor."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "billing"
          ],
          "properties": {
            "billing": {
              "type": "object",
              "required": [
                "domain",
                "payerPolicy",
                "fallbackToOwner"
              ],
              "properties": {
                "domain": {
                  "type": "string",
                  "description": "The domain."
                },
                "updatedAt": {
                  "type": "string",
                  "format": "datetime",
                  "description": "When this last changed. Absent when the domain is using the default."
                },
                "payerPolicy": {
                  "type": "string",
                  "description": "owner or visitor.",
                  "knownValues": [
                    "owner",
                    "visitor"
                  ]
                },
                "fallbackToOwner": {
                  "type": "boolean",
                  "description": "Under the visitor policy: whether a visitor who has run out falls back to the owner instead of being refused."
                },
                "visitorCapBytes": {
                  "type": "integer",
                  "description": "The most any one visitor can spend here per period."
                },
                "ownerBudgetBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "How many bytes of the owner's allowance this site may spend per period on readers who are not signed in. 0 requires sign-in for everything. When set, it determines payerPolicy and fallbackToOwner; when omitted, those two apply as set."
                }
              },
              "description": "Whose allowance a domain's traffic uses."
            },
            "approvalsRevoked": {
              "type": "integer",
              "description": "How many visitor approvals the policy change revoked."
            }
          }
        },
        "encoding": "application/json"
      },
      "description": "Set whose allowance a domain's traffic uses. Changing payerPolicy revokes every visitor approval on the domain, since visitors agreed to the old arrangement. The owner always pays whatever nobody else covers."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
