> ## Documentation Index
> Fetch the complete documentation index at: https://docs.springwinter.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Organization and billing

> Exact request and response contracts for organization and billing.

Generated from the application OpenAPI contract. Do not edit endpoint examples independently.

Read the [agent guide](https://docs.springwinter.dev/api-reference/agents.md) before automating deployments. Fetch the complete schema with `GET /api/openapi.json` and your bearer token. The interactive reference is [in the app](https://springwinter.dev/docs/api).

Authenticated operations accept `Authorization: Bearer $SPRINGWINTER_TOKEN`. Cookie mutations require a CSRF token. Signed webhooks use their own signature checks. Read each operation's security setting.

## GET `/api/billing`

GET /api/billing

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "GET /api/billing",
  "operationId": "getApiBilling",
  "responses": {
    "200": {
      "description": "Successful response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "plan": {
                "type": "string"
              },
              "subscription": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "status": {
                        "type": "string"
                      },
                      "current_period_end": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "cancel_at_period_end": {
                        "type": "boolean"
                      },
                      "cancel_at": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "status",
                      "current_period_end",
                      "cancel_at_period_end",
                      "cancel_at"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "invoices": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "status": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "amount_paid": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "created_at": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "hosted_invoice_url": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "invoice_pdf": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "number",
                    "status",
                    "amount_paid",
                    "currency",
                    "created_at",
                    "hosted_invoice_url",
                    "invoice_pdf"
                  ]
                }
              }
            },
            "required": [
              "plan",
              "subscription",
              "invoices"
            ]
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "unauthenticated"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "502": {
      "description": "billing_unavailable",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "billing_unavailable"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "parameters": []
}
```

## POST `/api/billing/checkout`

POST /api/billing/checkout

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "POST /api/billing/checkout",
  "operationId": "postApiBillingCheckout",
  "responses": {
    "200": {
      "description": "Successful response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "required": [
              "url"
            ]
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "unauthenticated"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "400": {
      "description": "invalid_parameters",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_parameters"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "422": {
      "description": "invalid_csrf_token; invalid_billing_plan",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_csrf_token",
                  "invalid_billing_plan"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "502": {
      "description": "billing_unavailable",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "billing_unavailable"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "billing": {
              "type": "object",
              "properties": {
                "plan": {
                  "type": "string",
                  "enum": [
                    "pro",
                    "enterprise"
                  ]
                },
                "onboarding": {
                  "type": "boolean",
                  "default": false
                }
              },
              "required": [
                "plan"
              ]
            }
          },
          "required": [
            "billing"
          ]
        }
      }
    }
  },
  "parameters": []
}
```

## POST `/api/billing/portal`

POST /api/billing/portal

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "POST /api/billing/portal",
  "operationId": "postApiBillingPortal",
  "responses": {
    "200": {
      "description": "Successful response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "required": [
              "url"
            ]
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "unauthenticated"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "422": {
      "description": "invalid_csrf_token",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_csrf_token"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "502": {
      "description": "billing_unavailable",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "billing_unavailable"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "parameters": []
}
```

## POST `/api/members`

POST /api/members

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "POST /api/members",
  "operationId": "postApiMembers",
  "responses": {
    "201": {
      "description": "Successful response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "user": {
                "$ref": "#/components/schemas/AccountProfile"
              }
            },
            "required": [
              "user"
            ]
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "unauthenticated"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "400": {
      "description": "invalid_parameters",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_parameters"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "422": {
      "description": "invalid_csrf_token; invalid_member; invitation_email_failed",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_csrf_token",
                  "invalid_member",
                  "invitation_email_failed"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "member": {
              "type": "object",
              "properties": {
                "email_address": {
                  "type": "string",
                  "format": "email"
                }
              },
              "required": [
                "email_address"
              ]
            }
          },
          "required": [
            "member"
          ]
        }
      }
    }
  },
  "parameters": []
}
```

## DELETE `/api/members/{id}`

DELETE /api/members/{id}

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "DELETE /api/members/{id}",
  "operationId": "deleteApiMembersId",
  "responses": {
    "200": {
      "description": "Successful response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "user": {
                "$ref": "#/components/schemas/AccountProfile"
              }
            },
            "required": [
              "user"
            ]
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "unauthenticated"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "422": {
      "description": "invalid_csrf_token; cannot_remove_self",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_csrf_token",
                  "cannot_remove_self"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "404": {
      "description": "member_not_found",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "member_not_found"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ]
}
```

## PATCH `/api/organization`

PATCH /api/organization

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "PATCH /api/organization",
  "operationId": "patchApiOrganization",
  "responses": {
    "200": {
      "description": "Successful response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "user": {
                "$ref": "#/components/schemas/AccountProfile"
              }
            },
            "required": [
              "user"
            ]
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "unauthenticated"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "400": {
      "description": "invalid_parameters",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_parameters"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "422": {
      "description": "invalid_csrf_token; invalid_organization; billing_required",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_csrf_token",
                  "invalid_organization",
                  "billing_required"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "organization": {
              "type": "object",
              "properties": {
                "plan": {
                  "type": "string",
                  "enum": [
                    "free"
                  ]
                }
              },
              "required": [
                "plan"
              ]
            }
          },
          "required": [
            "organization"
          ]
        }
      }
    }
  },
  "parameters": []
}
```

## PUT `/api/organization`

PATCH /api/organization

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "PATCH /api/organization",
  "operationId": "putApiOrganization",
  "responses": {
    "200": {
      "description": "Successful response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "user": {
                "$ref": "#/components/schemas/AccountProfile"
              }
            },
            "required": [
              "user"
            ]
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "unauthenticated"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "400": {
      "description": "invalid_parameters",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_parameters"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    },
    "422": {
      "description": "invalid_csrf_token; invalid_organization; billing_required",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_csrf_token",
                  "invalid_organization",
                  "billing_required"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "organization": {
              "type": "object",
              "properties": {
                "plan": {
                  "type": "string",
                  "enum": [
                    "free"
                  ]
                }
              },
              "required": [
                "plan"
              ]
            }
          },
          "required": [
            "organization"
          ]
        }
      }
    }
  },
  "parameters": []
}
```

## POST `/api/stripe/webhook`

POST /api/stripe/webhook

```json theme={null}
{
  "tags": [
    "Account"
  ],
  "summary": "POST /api/stripe/webhook",
  "operationId": "postApiStripeWebhook",
  "responses": {
    "204": {
      "description": "Event queued, or duplicate event accepted"
    },
    "401": {
      "description": "invalid_signature",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "enum": [
                  "invalid_signature"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  },
  "security": [],
  "parameters": [
    {
      "name": "Stripe-Signature",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {},
          "required": []
        }
      }
    }
  }
}
```

## Referenced definitions

These keys resolve the local references in the operations above.

```json theme={null}
{
  "#/components/schemas/AccountProfile": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "email_address": {
        "type": "string"
      },
      "name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "avatar_url": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "sign_in_methods": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "organization": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "pro",
              "enterprise"
            ]
          },
          "members": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email_address": {
                  "type": "string"
                },
                "avatar_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "email_address",
                "avatar_url"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "plan",
          "members"
        ]
      }
    },
    "required": [
      "id",
      "email_address",
      "name",
      "avatar_url",
      "sign_in_methods",
      "organization"
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.