# Change the remembered billing country and US state; never starts a payment

`PATCH` `/api/v1/workspaces/{workspace}/billing/location`

`updateBillingLocation`

Who can call it: An API token with the "billing" scope, or an owner of this workspace, signed in.

**Scopes:** `billing`

**Parameters**

| Name | In | Required | Type and constraints | Description / example |
| --- | --- | --- | --- | --- |
| `workspace` | path | Yes | `string`; pattern: `"^ws_[a-z0-9]{16}$"` |  Example: `"ws_aaaaaaaaaaaaaaaa"` |

**JSON body**

| Field | Required | Type and constraints | Description |
| --- | --- | --- | --- |
| `billing` | Yes | `object` |  |

**Request example**

```http
PATCH https://app.flaghand.com/api/v1/workspaces/ws_aaaaaaaaaaaaaaaa/billing/location
Authorization: Bearer tok_<your workspace token>
Content-Type: application/json

{
  "billing": {
    "country": "US",
    "state": "NY"
  }
}
```

**Response example**

```json
{
  "billing_location": {
    "country": "US",
    "state": "NY",
    "revision": 1
  },
  "payment_routing": {
    "eligible": true,
    "reason": "us_payer"
  }
}
```

Success: HTTP 200. Content-Type: application/json.

**Errors:** `invalid_request` (400), `internal` (500), `unauthorized` (401), `invalid_token` (401), `session_expired` (401), `bad_origin` (403), `scope_missing` (403), `owner_session_required` (403), `invalid_json` (400), `not_found` (404). See the [error codes](https://app.flaghand.com/docs/errors.md) for meanings and the shared default error response. Other domain errors from that catalog may apply; the response's code and message are authoritative.

**CLI:** `flaghand billing update-location`

```sh
flaghand billing update-location --workspace ws_aaaaaaaaaaaaaaaa -d '{"billing":{"country":"US","state":"NY"}}' --json
```

**MCP tool:** `updateBillingLocation` (also reachable through `callWriteOperation`; use `getOperation` to load its full schema).

```json
{
  "name": "callWriteOperation",
  "arguments": {
    "operation_id": "updateBillingLocation",
    "arguments": {
      "workspace": "ws_aaaaaaaaaaaaaaaa",
      "billing": {
        "country": "US",
        "state": "NY"
      }
    }
  }
}
```

Base URL: `https://app.flaghand.com/api/v1`. Part of the [API reference](https://app.flaghand.com/docs/api.md); every error code is in [errors](https://app.flaghand.com/docs/errors.md).
