{
	"openapi": "3.1.0",
	"info": {
		"title": "Solarstream API",
		"version": "1.0.0",
		"description": "## Overview\n\nThe Solarstream API provides programmatic access to your solar installation project management data.\n\n## Authentication\n\nAll API requests require authentication using one of the following methods:\n\n1. **Bearer Token (OAuth 2.1)**: Include the access token from Supabase authentication in the Authorization header.\n2. **API Key**: Use an API key from Settings > API Keys in the X-API-Key header.\n\n## Multi-Tenancy\n\nIf your user belongs to multiple accounts, include the `X-Account-Id` header to specify which account context to use.\n\n## Rate Limiting\n\n- OAuth tokens: 1000 requests per minute\n- API keys: 60 requests per minute\n- Unauthenticated: 10 requests per minute\n\n## Response Format\n\nAll responses follow a consistent envelope format:\n\n```json\n{\n  \"data\": { ... },  // Single item or array\n  \"meta\": {         // Pagination info (for list endpoints)\n    \"page\": 1,\n    \"pageSize\": 20,\n    \"total\": 150,\n    \"hasMore\": true\n  }\n}\n```\n\n## Errors\n\nError responses follow a consistent format:\n\n```json\n{\n  \"error\": {\n    \"code\": \"validation_error\",\n    \"message\": \"Human-readable description\",\n    \"details\": [\n      { \"field\": \"email\", \"message\": \"Invalid format\" }\n    ]\n  }\n}\n```",
		"contact": {
			"name": "Solarstream Support",
			"url": "https://solarstream.ch/support",
			"email": "support@solarstream.ch"
		},
		"license": {
			"name": "Proprietary",
			"url": "https://solarstream.ch/terms"
		}
	},
	"servers": [
		{
			"url": "",
			"description": "Current Origin (Recommended)"
		},
		{
			"url": "https://app.solarstream.ch",
			"description": "Production"
		},
		{
			"url": "https://staging.solarstream.ch",
			"description": "Staging"
		},
		{
			"url": "http://localhost:5173",
			"description": "Local Development (Port 5173)"
		}
	],
	"tags": [
		{
			"name": "Health",
			"description": "Health check endpoints"
		},
		{
			"name": "Accounts",
			"description": "Accounts the caller belongs to"
		},
		{
			"name": "Leads",
			"description": "Lead management endpoints"
		},
		{
			"name": "Projects",
			"description": "Project management endpoints"
		},
		{
			"name": "Contacts",
			"description": "Contact management endpoints"
		},
		{
			"name": "Tasks",
			"description": "Task management endpoints"
		},
		{
			"name": "Team Members",
			"description": "Team member management endpoints"
		},
		{
			"name": "Files",
			"description": "File storage endpoints"
		},
		{
			"name": "Schedule",
			"description": "Resource planner schedule (read-only)"
		},
		{
			"name": "Customers",
			"description": "Customer management endpoints"
		},
		{
			"name": "Comments",
			"description": "Comment endpoints"
		},
		{
			"name": "Notes",
			"description": "Project, stage and task notes (read-only)"
		},
		{
			"name": "Offers",
			"description": "Offers of a lead or project with their variants, line items and discounts (read-only)"
		},
		{
			"name": "Search",
			"description": "Search endpoints"
		},
		{
			"name": "Webhooks",
			"description": "Solarstream sends a signed JSON `POST` to your URL as soon as something happens. An account owner registers the URL under Settings > Developer > Webhooks; only `https` URLs are accepted.\n\n**Verify requests.** Every request follows [Standard Webhooks](https://www.standardwebhooks.com). `webhook-signature` is `v1,` followed by the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of your signing secret after `whsec_`. Reject old timestamps, and drop a `webhook-id` you have already processed.\n\n**Retries.** Answer with a 2xx status within 10 seconds. Anything else, a redirect included, is retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h (8 attempts in total). Every attempt sends the same body."
		}
	],
	"externalDocs": {
		"description": "API Documentation",
		"url": "/api/docs"
	},
	"components": {
		"securitySchemes": {
			"BearerAuth": {
				"type": "http",
				"scheme": "bearer",
				"bearerFormat": "JWT",
				"description": "OAuth 2.1 access token from Supabase authentication"
			},
			"ApiKeyAuth": {
				"type": "apiKey",
				"in": "header",
				"name": "X-API-Key",
				"description": "API key for programmatic access (see Settings > API Keys)"
			},
			"AccountContext": {
				"type": "apiKey",
				"in": "header",
				"name": "X-Account-Id",
				"description": "Account ID for multi-tenant context (optional if user has single account)"
			}
		},
		"schemas": {
			"LeadCreatedEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Event ID, identical on every attempt; also the `webhook-id` header"
					},
					"type": {
						"type": "string",
						"enum": ["lead.created"]
					},
					"apiVersion": {
						"type": "string",
						"enum": ["v1"]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the event happened"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account the event belongs to"
					},
					"test": {
						"type": "boolean",
						"enum": [true],
						"description": "Present only on a test event sent from the settings"
					},
					"data": {
						"type": "object",
						"properties": {
							"lead": {
								"$ref": "#/components/schemas/Lead"
							}
						},
						"required": ["lead"],
						"additionalProperties": false
					}
				},
				"required": ["id", "type", "apiVersion", "createdAt", "accountId", "data"],
				"additionalProperties": false
			},
			"Lead": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this lead belongs to"
					},
					"internalId": {
						"type": ["string", "null"],
						"example": "L-0042",
						"description": "Lead number shown in the app"
					},
					"title": {
						"type": "string",
						"example": "Müller – PV Einfamilienhaus",
						"description": "Lead title (unique among active leads)"
					},
					"internalReference": {
						"type": ["string", "null"],
						"description": "Internal reference / label"
					},
					"status": {
						"type": "string",
						"enum": ["active", "won", "lost", "archived"],
						"example": "active",
						"description": "Lead status: active (open in the pipeline), won, lost or archived. Won/lost follow the pipeline column type."
					},
					"columnId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Pipeline column — an `id` from `GET /api/v1/lead-columns`"
					},
					"column": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/LeadColumn"
							},
							{
								"type": "null"
							}
						],
						"description": "The pipeline column `columnId` names, with its title (also for an archived column)"
					},
					"lostReason": {
						"type": ["string", "null"],
						"description": "Why the lead was lost (lost leads only)"
					},
					"estimatedValue": {
						"type": ["number", "null"],
						"example": 32000,
						"description": "Estimated value (CHF)"
					},
					"priority": {
						"type": ["string", "null"],
						"enum": ["low", "medium", "high", "urgent", null],
						"example": "medium",
						"description": "Lead priority"
					},
					"source": {
						"type": ["string", "null"],
						"example": "website",
						"description": "Where the lead came from"
					},
					"sourceDetails": {
						"type": ["string", "null"],
						"description": "Free-text detail on the source"
					},
					"assigneeId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team member: `TeamMember.id` from `GET /api/v1/team-members`, not its `userId`"
					},
					"deadline": {
						"type": ["string", "null"],
						"format": "date",
						"example": "2024-01-15",
						"description": "Submission deadline (Eingabefrist)"
					},
					"customer": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/LeadCustomer"
							},
							{
								"type": "null"
							}
						],
						"description": "Customer contact (null when none is linked, or when the API key lacks the `contacts` read scope)"
					},
					"address": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/LeadObjectAddress"
							},
							{
								"type": "null"
							}
						],
						"description": "Object (installation) address; null when none"
					},
					"convertedToProjectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project the lead was converted into"
					},
					"wonAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"lostAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"createdAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the lead was archived (null = not archived)"
					}
				},
				"required": [
					"id",
					"accountId",
					"internalId",
					"title",
					"internalReference",
					"status",
					"columnId",
					"column",
					"lostReason",
					"estimatedValue",
					"priority",
					"source",
					"sourceDetails",
					"assigneeId",
					"deadline",
					"customer",
					"address",
					"convertedToProjectId",
					"wonAt",
					"lostAt",
					"createdAt",
					"updatedAt",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"LeadColumn": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"title": {
						"type": "string",
						"example": "Neu",
						"description": "Column title as shown on the lead board"
					},
					"type": {
						"type": "string",
						"enum": ["active", "won", "lost"],
						"description": "What a lead in this column is: active (open), won or lost"
					},
					"position": {
						"type": "integer",
						"description": "Order on the board, left to right"
					}
				},
				"required": ["id", "title", "type", "position"],
				"additionalProperties": false
			},
			"LeadCustomer": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact ID of the customer"
					},
					"kind": {
						"type": "string",
						"enum": ["private", "business"],
						"description": "Contact kind"
					},
					"name": {
						"type": "string",
						"example": "Müller AG",
						"description": "Display name: the company for a business contact, the person otherwise"
					}
				},
				"required": ["id", "kind", "name"],
				"additionalProperties": false
			},
			"LeadObjectAddress": {
				"type": "object",
				"properties": {
					"street": {
						"type": ["string", "null"],
						"example": "Bahnhofstrasse"
					},
					"houseNumber": {
						"type": ["string", "null"],
						"example": "10"
					},
					"zip": {
						"type": ["string", "null"],
						"example": "8001"
					},
					"city": {
						"type": ["string", "null"],
						"example": "Zürich"
					},
					"canton": {
						"type": ["string", "null"],
						"example": "ZH",
						"description": "Swiss canton, when known"
					},
					"country": {
						"type": ["string", "null"],
						"example": "CH",
						"description": "ISO 3166-1 alpha-2 country code"
					}
				},
				"required": ["street", "houseNumber", "zip", "city", "canton", "country"],
				"additionalProperties": false
			},
			"LeadStatusChangedEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Event ID, identical on every attempt; also the `webhook-id` header"
					},
					"type": {
						"type": "string",
						"enum": ["lead.status_changed"]
					},
					"apiVersion": {
						"type": "string",
						"enum": ["v1"]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the event happened"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account the event belongs to"
					},
					"test": {
						"type": "boolean",
						"enum": [true],
						"description": "Present only on a test event sent from the settings"
					},
					"data": {
						"type": "object",
						"properties": {
							"lead": {
								"$ref": "#/components/schemas/Lead"
							},
							"previous": {
								"type": "object",
								"properties": {
									"status": {
										"type": "string",
										"enum": ["active", "won", "lost", "archived"],
										"example": "active",
										"description": "Lead status: active (open in the pipeline), won, lost or archived. Won/lost follow the pipeline column type."
									},
									"columnId": {
										"type": "string",
										"format": "uuid",
										"example": "550e8400-e29b-41d4-a716-446655440000",
										"description": "Unique identifier (UUID v4)"
									},
									"column": {
										"anyOf": [
											{
												"$ref": "#/components/schemas/LeadColumn"
											},
											{
												"type": "null"
											}
										]
									}
								},
								"additionalProperties": false,
								"description": "What the lead was before the change"
							}
						},
						"required": ["lead", "previous"],
						"additionalProperties": false
					}
				},
				"required": ["id", "type", "apiVersion", "createdAt", "accountId", "data"],
				"additionalProperties": false
			},
			"ProjectCreatedEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Event ID, identical on every attempt; also the `webhook-id` header"
					},
					"type": {
						"type": "string",
						"enum": ["project.created"]
					},
					"apiVersion": {
						"type": "string",
						"enum": ["v1"]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the event happened"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account the event belongs to"
					},
					"test": {
						"type": "boolean",
						"enum": [true],
						"description": "Present only on a test event sent from the settings"
					},
					"data": {
						"type": "object",
						"properties": {
							"project": {
								"$ref": "#/components/schemas/Project"
							}
						},
						"required": ["project"],
						"additionalProperties": false
					}
				},
				"required": ["id", "type", "apiVersion", "createdAt", "accountId", "data"],
				"additionalProperties": false
			},
			"Project": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this project belongs to"
					},
					"internalId": {
						"type": ["string", "null"],
						"example": "P-2024-0042",
						"description": "Project number shown in the app (assigned by the account, may be null)"
					},
					"internalReference": {
						"type": ["string", "null"],
						"example": "Müller – Bahnhofstrasse 10",
						"description": "Internal reference / label of the project"
					},
					"description": {
						"type": ["string", "null"],
						"example": "Rooftop solar installation for residential property",
						"description": "Project description"
					},
					"stage": {
						"type": ["string", "null"],
						"enum": ["in_sale", "in_installation", "completed", null],
						"example": "in_sale",
						"description": "Project stage; null for a project that never entered one (no lifecycle timestamp)"
					},
					"type": {
						"type": ["string", "null"],
						"example": "pv",
						"description": "Project type (set by the template)"
					},
					"customer": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ProjectCustomer"
							},
							{
								"type": "null"
							}
						],
						"description": "Customer contact (null when none is linked, or when the API key lacks the `contacts` read scope)"
					},
					"contacts": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ProjectContact"
						},
						"description": "Every contact linked to the project with its role (customer, owner, management, partner). Empty when none is linked, or when the API key lacks the `contacts` read scope."
					},
					"address": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ProjectObjectAddress"
							},
							{
								"type": "null"
							}
						],
						"description": "Installation address of the project’s object (null when the project has no object)"
					},
					"coordinates": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/ProjectCoordinates"
							},
							{
								"type": "null"
							}
						],
						"description": "WGS84 position of the project’s object (null when unknown)"
					},
					"assigneeId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team member: `TeamMember.id` from `GET /api/v1/team-members`, not its `userId`"
					},
					"commissioningDate": {
						"type": ["string", "null"],
						"format": "date",
						"example": "2024-01-15",
						"description": "Commissioning date"
					},
					"completedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the project was completed"
					},
					"createdAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the project was archived (null = active)"
					}
				},
				"required": [
					"id",
					"accountId",
					"internalId",
					"internalReference",
					"description",
					"stage",
					"type",
					"customer",
					"contacts",
					"address",
					"coordinates",
					"assigneeId",
					"commissioningDate",
					"completedAt",
					"createdAt",
					"updatedAt",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"ProjectCustomer": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact ID of the customer"
					},
					"kind": {
						"type": "string",
						"enum": ["private", "business"],
						"description": "Contact kind"
					},
					"name": {
						"type": "string",
						"example": "Müller AG",
						"description": "Display name: the company for a business contact, the person otherwise"
					}
				},
				"required": ["id", "kind", "name"],
				"additionalProperties": false
			},
			"ProjectContact": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact ID (`Contact.id`)"
					},
					"role": {
						"type": "string",
						"enum": ["customer", "owner", "management", "partner"],
						"example": "owner",
						"description": "Role on the project: customer, owner (Eigentümer), management (Verwaltung) or partner (e.g. an installer or planner)"
					},
					"kind": {
						"type": "string",
						"enum": ["private", "business"],
						"description": "Contact kind"
					},
					"name": {
						"type": "string",
						"example": "Müller AG",
						"description": "Display name: the company for a business contact, the person otherwise"
					}
				},
				"required": ["id", "role", "kind", "name"],
				"additionalProperties": false
			},
			"ProjectObjectAddress": {
				"type": "object",
				"properties": {
					"street": {
						"type": ["string", "null"],
						"example": "Bahnhofstrasse"
					},
					"houseNumber": {
						"type": ["string", "null"],
						"example": "10"
					},
					"zip": {
						"type": ["string", "null"],
						"example": "8001"
					},
					"city": {
						"type": ["string", "null"],
						"example": "Zürich"
					},
					"canton": {
						"type": ["string", "null"],
						"example": "ZH",
						"description": "Swiss canton, when known"
					},
					"country": {
						"type": ["string", "null"],
						"example": "CH",
						"description": "ISO 3166-1 alpha-2 country code"
					}
				},
				"required": ["street", "houseNumber", "zip", "city", "canton", "country"],
				"additionalProperties": false
			},
			"ProjectCoordinates": {
				"type": "object",
				"properties": {
					"latitude": {
						"type": "number",
						"example": 47.3769
					},
					"longitude": {
						"type": "number",
						"example": 8.5417
					}
				},
				"required": ["latitude", "longitude"],
				"additionalProperties": false
			},
			"ProjectCompletedEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Event ID, identical on every attempt; also the `webhook-id` header"
					},
					"type": {
						"type": "string",
						"enum": ["project.completed"]
					},
					"apiVersion": {
						"type": "string",
						"enum": ["v1"]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the event happened"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account the event belongs to"
					},
					"test": {
						"type": "boolean",
						"enum": [true],
						"description": "Present only on a test event sent from the settings"
					},
					"data": {
						"type": "object",
						"properties": {
							"project": {
								"$ref": "#/components/schemas/Project"
							}
						},
						"required": ["project"],
						"additionalProperties": false
					}
				},
				"required": ["id", "type", "apiVersion", "createdAt", "accountId", "data"],
				"additionalProperties": false
			},
			"OfferAcceptedEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Event ID, identical on every attempt; also the `webhook-id` header"
					},
					"type": {
						"type": "string",
						"enum": ["offer.accepted"]
					},
					"apiVersion": {
						"type": "string",
						"enum": ["v1"]
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the event happened"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account the event belongs to"
					},
					"test": {
						"type": "boolean",
						"enum": [true],
						"description": "Present only on a test event sent from the settings"
					},
					"data": {
						"type": "object",
						"properties": {
							"offer": {
								"$ref": "#/components/schemas/Offer"
							}
						},
						"required": ["offer"],
						"additionalProperties": false
					}
				},
				"required": ["id", "type", "apiVersion", "createdAt", "accountId", "data"],
				"additionalProperties": false
			},
			"Offer": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"offerNumber": {
						"type": "string",
						"example": "OF-2026-0042"
					},
					"title": {
						"type": ["string", "null"],
						"description": "Document title of the offer"
					},
					"status": {
						"type": "string",
						"enum": ["draft", "sent", "accepted", "rejected"]
					},
					"leadId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Lead the offer belongs to (GET /api/v1/leads/{id})"
					},
					"projectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project the offer belongs to"
					},
					"currency": {
						"type": "string",
						"enum": ["CHF"]
					},
					"validUntil": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"paymentTerms": {
						"type": ["string", "null"]
					},
					"sentAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"acceptedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"acceptedVariantId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "The accepted variant; null while the offer is not accepted"
					},
					"discounts": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/OfferDiscount"
						},
						"description": "Offer-wide discount rows, applied in order to each variant after its own discount"
					},
					"variants": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/OfferVariant"
						},
						"description": "Not accepted: every variant, each with its own lines and totals — alternatives, never to be added up. Accepted: only the accepted variant; its lines and totals are what the customer signed"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					}
				},
				"required": [
					"id",
					"accountId",
					"offerNumber",
					"title",
					"status",
					"leadId",
					"projectId",
					"currency",
					"validUntil",
					"paymentTerms",
					"sentAt",
					"acceptedAt",
					"acceptedVariantId",
					"discounts",
					"variants",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"OfferDiscount": {
				"type": "object",
				"properties": {
					"label": {
						"type": "string",
						"example": "Skonto",
						"description": "The installer’s name for the row; may be blank"
					},
					"type": {
						"type": "string",
						"enum": ["percentage", "fixed"],
						"description": "`percentage`: `value` percent of the amount left. `fixed`: `value` CHF"
					},
					"value": {
						"type": "number",
						"example": 2
					}
				},
				"required": ["label", "type", "value"],
				"additionalProperties": false
			},
			"OfferVariant": {
				"type": "object",
				"properties": {
					"id": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Variant id; null only for an offer created before variants existed (its single implicit variant)"
					},
					"title": {
						"type": ["string", "null"],
						"example": "Mit Batteriespeicher"
					},
					"position": {
						"type": "integer",
						"description": "Order of the variant on the offer, from 0"
					},
					"accepted": {
						"type": "boolean",
						"description": "True for the variant the customer accepted"
					},
					"discount": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/OfferVariantDiscount"
							},
							{
								"type": "null"
							}
						],
						"description": "The variant’s own discount"
					},
					"lineItems": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/OfferLineItem"
						},
						"description": "This variant’s lines, in offer order"
					},
					"totals": {
						"$ref": "#/components/schemas/OfferTotals"
					}
				},
				"required": ["id", "title", "position", "accepted", "discount", "lineItems", "totals"],
				"additionalProperties": false
			},
			"OfferVariantDiscount": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"enum": ["percentage", "fixed"],
						"description": "`percentage`: `value` percent of the amount left. `fixed`: `value` CHF"
					},
					"value": {
						"type": "number",
						"example": 500
					}
				},
				"required": ["type", "value"],
				"additionalProperties": false
			},
			"OfferLineItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"group": {
						"type": "string",
						"example": "PV-Anlage",
						"description": "Title of the block the line is listed under on the offer (e.g. PV system, battery)"
					},
					"product": {
						"type": "string",
						"example": "Solarmodul 430 Wp"
					},
					"description": {
						"type": ["string", "null"]
					},
					"unit": {
						"type": ["string", "null"],
						"example": "Stk"
					},
					"quantity": {
						"type": "number",
						"example": 24
					},
					"unitPrice": {
						"type": "number",
						"example": 189.5,
						"description": "Net unit price in CHF"
					},
					"vatRate": {
						"type": "number",
						"example": 8.1,
						"description": "VAT rate in percent the line is charged at"
					},
					"net": {
						"type": "number",
						"description": "quantity × unitPrice, rounded to cents (before discounts)"
					},
					"optional": {
						"type": "boolean",
						"description": "An optional position the customer may add: listed outside the offer price and excluded from every total"
					},
					"customerQuantity": {
						"type": ["integer", "null"],
						"description": "For an optional position: the quantity the customer chose in the portal, null when not chosen"
					},
					"recurringAnnual": {
						"type": "boolean",
						"description": "The unit price is per year"
					},
					"componentId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "The account component (catalog hardware: module, inverter, battery, …) the line refers to"
					},
					"productServiceId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "The product/service catalog item the line was added from"
					},
					"sku": {
						"type": ["string", "null"],
						"description": "Article number"
					}
				},
				"required": [
					"id",
					"group",
					"product",
					"description",
					"unit",
					"quantity",
					"unitPrice",
					"vatRate",
					"net",
					"optional",
					"customerQuantity",
					"recurringAnnual",
					"componentId",
					"productServiceId",
					"sku"
				],
				"additionalProperties": false
			},
			"OfferTotals": {
				"type": "object",
				"properties": {
					"lineNet": {
						"type": "number",
						"description": "Sum of the mandatory lines’ net, before discounts"
					},
					"discount": {
						"type": "number",
						"description": "Total CHF taken off by every discount step"
					},
					"discounts": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/OfferAppliedDiscount"
						},
						"description": "Each discount step in application order: the variant discount, then the offer rows"
					},
					"net": {
						"type": "number",
						"description": "Net after discounts"
					},
					"vat": {
						"type": "number",
						"description": "VAT on the discounted net (per line rate, discounts pro rata)"
					},
					"gross": {
						"type": "number",
						"description": "net + vat: the price the customer signs"
					}
				},
				"required": ["lineNet", "discount", "discounts", "net", "vat", "gross"],
				"additionalProperties": false
			},
			"OfferAppliedDiscount": {
				"type": "object",
				"properties": {
					"source": {
						"type": "string",
						"enum": ["variant", "offer"],
						"description": "`variant`: the variant’s own discount (applied first). `offer`: an offer-wide row, in order"
					},
					"label": {
						"type": "string"
					},
					"type": {
						"type": "string",
						"enum": ["percentage", "fixed"],
						"description": "`percentage`: `value` percent of the amount left. `fixed`: `value` CHF"
					},
					"value": {
						"type": "number"
					},
					"amount": {
						"type": "number",
						"example": 250.5,
						"description": "CHF this step took off (net), rounded to cents"
					}
				},
				"required": ["source", "label", "type", "value", "amount"],
				"additionalProperties": false
			},
			"ErrorResponse": {
				"type": "object",
				"properties": {
					"error": {
						"type": "object",
						"properties": {
							"code": {
								"type": "string",
								"enum": ["bad_request"]
							},
							"message": {
								"type": "string",
								"example": "Invalid request"
							}
						},
						"required": ["code", "message"]
					}
				},
				"required": ["error"]
			},
			"ValidationError": {
				"type": "object",
				"properties": {
					"error": {
						"type": "object",
						"properties": {
							"code": {
								"type": "string",
								"enum": ["validation_error"]
							},
							"message": {
								"type": "string",
								"example": "Request validation failed"
							},
							"details": {
								"type": "array",
								"items": {
									"type": "object",
									"properties": {
										"field": {
											"type": "string",
											"example": "email"
										},
										"message": {
											"type": "string",
											"example": "Invalid email format"
										}
									},
									"required": ["field", "message"]
								}
							}
						},
						"required": ["code", "message", "details"]
					}
				},
				"required": ["error"]
			},
			"NotFoundError": {
				"type": "object",
				"properties": {
					"error": {
						"type": "object",
						"properties": {
							"code": {
								"type": "string",
								"enum": ["not_found"]
							},
							"message": {
								"type": "string",
								"example": "Resource not found"
							}
						},
						"required": ["code", "message"]
					}
				},
				"required": ["error"]
			},
			"UnauthorizedError": {
				"type": "object",
				"properties": {
					"error": {
						"type": "object",
						"properties": {
							"code": {
								"type": "string",
								"enum": ["unauthorized"]
							},
							"message": {
								"type": "string",
								"example": "Authentication required"
							}
						},
						"required": ["code", "message"]
					}
				},
				"required": ["error"]
			},
			"ForbiddenError": {
				"type": "object",
				"properties": {
					"error": {
						"type": "object",
						"properties": {
							"code": {
								"type": "string",
								"enum": ["forbidden"]
							},
							"message": {
								"type": "string",
								"example": "Access denied"
							}
						},
						"required": ["code", "message"]
					}
				},
				"required": ["error"]
			},
			"HealthResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "object",
						"properties": {
							"status": {
								"type": "string",
								"enum": ["ok", "degraded", "error"],
								"example": "ok",
								"description": "Current health status"
							},
							"version": {
								"type": "string",
								"example": "1",
								"description": "API version"
							},
							"timestamp": {
								"type": "string",
								"format": "date-time",
								"example": "2024-01-15T10:30:00.000Z",
								"description": "Server timestamp"
							}
						},
						"required": ["status", "version", "timestamp"]
					}
				},
				"required": ["data"]
			},
			"AccountMembership": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account ID — send it as `X-Account-Id` on every other request"
					},
					"name": {
						"type": ["string", "null"],
						"example": "Muster Solar AG"
					},
					"slug": {
						"type": ["string", "null"],
						"example": "muster-solar"
					},
					"role": {
						"type": "string",
						"example": "owner",
						"description": "Role of the calling user in this account"
					},
					"primaryOwner": {
						"type": "boolean",
						"description": "Whether the calling user is the primary owner"
					}
				},
				"required": ["id", "name", "slug", "role", "primaryOwner"],
				"additionalProperties": false
			},
			"ProjectAddress": {
				"type": "object",
				"properties": {
					"street": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "Bahnhofstrasse"
					},
					"houseNumber": {
						"type": "string",
						"maxLength": 50,
						"example": "10"
					},
					"zip": {
						"type": "string",
						"minLength": 1,
						"maxLength": 20,
						"example": "8001"
					},
					"city": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "Zürich"
					},
					"country": {
						"type": "string",
						"minLength": 2,
						"maxLength": 2,
						"example": "CH",
						"description": "ISO 3166-1 alpha-2 country code (default: CH)"
					}
				},
				"required": ["street", "zip", "city"]
			},
			"CreateProjectRequest": {
				"type": "object",
				"properties": {
					"templateId": {
						"type": "string",
						"minLength": 1,
						"maxLength": 100,
						"example": "solar",
						"description": "Project template to build the project from — an `id` from `GET /api/v1/project-templates`"
					},
					"customerContactId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact ID of the customer (`Contact.id`)"
					},
					"address": {
						"$ref": "#/components/schemas/ProjectAddress"
					},
					"internalReference": {
						"type": "string",
						"maxLength": 255,
						"example": "Müller – Bahnhofstrasse 10",
						"description": "Internal reference / label of the project"
					},
					"assigneeId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team member: `TeamMember.id` from `GET /api/v1/team-members`, not its `userId`; defaults to the caller"
					},
					"stage": {
						"type": "string",
						"enum": ["in_sale", "in_installation"],
						"example": "in_sale",
						"description": "Stage the new project starts in (default: in_sale)"
					}
				},
				"required": ["templateId", "customerContactId", "address"]
			},
			"UpdateProjectRequest": {
				"type": "object",
				"properties": {
					"internalReference": {
						"type": ["string", "null"],
						"maxLength": 255,
						"example": "Müller – Bahnhofstrasse 10",
						"description": "Internal reference / label of the project"
					},
					"description": {
						"type": ["string", "null"],
						"maxLength": 2000,
						"example": "Rooftop solar installation for residential property",
						"description": "Project description"
					},
					"stage": {
						"type": "string",
						"enum": ["in_sale", "in_installation", "completed"],
						"example": "in_sale",
						"description": "Move the project to this stage (sets or clears the lifecycle timestamps like the app)"
					},
					"type": {
						"type": ["string", "null"],
						"maxLength": 100,
						"example": "pv",
						"description": "Project type"
					},
					"assigneeId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team member: `TeamMember.id` from `GET /api/v1/team-members`, not its `userId`"
					},
					"commissioningDate": {
						"type": ["string", "null"],
						"format": "date",
						"example": "2024-01-15",
						"description": "Commissioning date"
					}
				}
			},
			"ProjectResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/Project"
					}
				},
				"required": ["data"]
			},
			"ProjectsListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Project"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"PaginationMeta": {
				"type": "object",
				"properties": {
					"page": {
						"type": "number",
						"example": 1
					},
					"pageSize": {
						"type": "number",
						"example": 20
					},
					"total": {
						"type": "number",
						"example": 150
					},
					"hasMore": {
						"type": "boolean",
						"example": true
					}
				},
				"required": ["page", "pageSize", "total", "hasMore"]
			},
			"ProjectTemplate": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"example": "solar",
						"description": "Template ID to pass as `templateId` when creating a project — a UUID for an account template, a short key (e.g. `solar`) for a system template"
					},
					"title": {
						"type": "string",
						"example": "PV-Anlage",
						"description": "Template name shown in the app"
					},
					"description": {
						"type": ["string", "null"],
						"description": "Template description"
					},
					"projectType": {
						"type": ["string", "null"],
						"example": "solar",
						"description": "Project type the template sets"
					},
					"taskCount": {
						"type": ["integer", "null"],
						"description": "Number of tasks the template creates"
					},
					"system": {
						"type": "boolean",
						"description": "True for a built-in system template. Creating a project from one first copies it into the account, as the app does"
					}
				},
				"required": ["id", "title", "description", "projectType", "taskCount", "system"],
				"additionalProperties": false
			},
			"ProjectTemplatesListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ProjectTemplate"
						}
					}
				},
				"required": ["data"]
			},
			"Contact": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this contact belongs to"
					},
					"kind": {
						"type": "string",
						"enum": ["private", "business"],
						"example": "private",
						"description": "Type of contact"
					},
					"roles": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"example": ["customer"],
						"description": "Roles held by the contact"
					},
					"categories": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"example": [],
						"description": "Categories assigned to the contact"
					},
					"private": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/PrivateContactData"
							},
							{
								"type": "null"
							}
						],
						"description": "Private contact data (present when kind is \"private\")"
					},
					"business": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/BusinessContactData"
							},
							{
								"type": "null"
							}
						],
						"description": "Business contact data (present when kind is \"business\")"
					},
					"parentContactId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Parent contact ID for hierarchical contacts"
					},
					"isPrimary": {
						"type": "boolean",
						"example": true,
						"description": "Whether this is the primary contact for the parent"
					},
					"metadata": {
						"type": ["object", "null"],
						"additionalProperties": {},
						"description": "Custom metadata key-value pairs"
					},
					"createdAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					}
				},
				"required": [
					"id",
					"accountId",
					"kind",
					"roles",
					"categories",
					"private",
					"business",
					"parentContactId",
					"isPrimary",
					"metadata",
					"createdAt",
					"updatedAt",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"PrivateContactData": {
				"type": "object",
				"properties": {
					"salutation": {
						"type": ["string", "null"],
						"example": "Herr"
					},
					"academicTitle": {
						"type": ["string", "null"],
						"example": "Dr."
					},
					"firstName": {
						"type": ["string", "null"],
						"example": "Hans"
					},
					"lastName": {
						"type": "string",
						"example": "Müller"
					},
					"email": {
						"type": ["string", "null"],
						"example": "hans.mueller@example.ch"
					},
					"phone": {
						"type": ["string", "null"],
						"example": "+41 79 123 45 67"
					},
					"website": {
						"type": ["string", "null"],
						"example": "https://mueller-solar.ch"
					},
					"street": {
						"type": ["string", "null"],
						"example": "Bahnhofstrasse"
					},
					"houseNumber": {
						"type": ["string", "null"],
						"example": "10"
					},
					"poBox": {
						"type": ["string", "null"],
						"example": "Postfach 12"
					},
					"addressLine1": {
						"type": ["string", "null"],
						"example": "c/o Müller"
					},
					"addressLine2": {
						"type": ["string", "null"],
						"example": "2. Stock"
					},
					"zip": {
						"type": ["string", "null"],
						"example": "8001"
					},
					"city": {
						"type": ["string", "null"],
						"example": "Zürich"
					},
					"country": {
						"type": ["string", "null"],
						"example": "CH"
					},
					"language": {
						"type": ["string", "null"],
						"example": "de",
						"description": "Correspondence language (de, fr, it, en)"
					}
				},
				"required": [
					"salutation",
					"academicTitle",
					"firstName",
					"lastName",
					"email",
					"phone",
					"website",
					"street",
					"houseNumber",
					"poBox",
					"addressLine1",
					"addressLine2",
					"zip",
					"city",
					"country",
					"language"
				],
				"additionalProperties": false
			},
			"BusinessContactData": {
				"type": "object",
				"properties": {
					"companyName": {
						"type": "string",
						"example": "Müller Solar AG"
					},
					"companyLine2": {
						"type": ["string", "null"],
						"example": "Abteilung Technik"
					},
					"email": {
						"type": ["string", "null"],
						"example": "hans.mueller@example.ch"
					},
					"phone": {
						"type": ["string", "null"],
						"example": "+41 79 123 45 67"
					},
					"website": {
						"type": ["string", "null"],
						"example": "https://mueller-solar.ch"
					},
					"street": {
						"type": ["string", "null"],
						"example": "Bahnhofstrasse"
					},
					"houseNumber": {
						"type": ["string", "null"],
						"example": "10"
					},
					"poBox": {
						"type": ["string", "null"],
						"example": "Postfach 12"
					},
					"addressLine1": {
						"type": ["string", "null"],
						"example": "c/o Müller"
					},
					"addressLine2": {
						"type": ["string", "null"],
						"example": "2. Stock"
					},
					"zip": {
						"type": ["string", "null"],
						"example": "8001"
					},
					"city": {
						"type": ["string", "null"],
						"example": "Zürich"
					},
					"country": {
						"type": ["string", "null"],
						"example": "CH"
					},
					"language": {
						"type": ["string", "null"],
						"example": "de",
						"description": "Correspondence language (de, fr, it, en)"
					}
				},
				"required": [
					"companyName",
					"companyLine2",
					"email",
					"phone",
					"website",
					"street",
					"houseNumber",
					"poBox",
					"addressLine1",
					"addressLine2",
					"zip",
					"city",
					"country",
					"language"
				],
				"additionalProperties": false
			},
			"CreatePrivateContactRequest": {
				"type": "object",
				"properties": {
					"kind": {
						"type": "string",
						"enum": ["private"],
						"example": "private"
					},
					"private": {
						"type": "object",
						"properties": {
							"lastName": {
								"type": "string",
								"minLength": 1,
								"example": "Müller",
								"description": "Last name (required)"
							},
							"salutation": {
								"type": "string",
								"example": "Herr"
							},
							"academicTitle": {
								"type": "string",
								"example": "Dr."
							},
							"firstName": {
								"type": "string",
								"example": "Hans"
							},
							"email": {
								"type": "string",
								"example": "hans.mueller@example.ch"
							},
							"phone": {
								"type": "string",
								"example": "+41 79 123 45 67"
							},
							"website": {
								"type": "string",
								"example": "https://mueller-solar.ch"
							},
							"street": {
								"type": "string",
								"example": "Bahnhofstrasse"
							},
							"houseNumber": {
								"type": "string",
								"example": "10"
							},
							"addressLine1": {
								"type": "string",
								"example": "c/o Müller"
							},
							"addressLine2": {
								"type": "string",
								"example": "2. Stock"
							},
							"zip": {
								"type": "string",
								"example": "8001"
							},
							"city": {
								"type": "string",
								"example": "Zürich"
							},
							"country": {
								"type": "string",
								"example": "CH"
							},
							"language": {
								"type": "string",
								"example": "de"
							}
						},
						"required": ["lastName"],
						"description": "Private contact data"
					},
					"roles": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"description": "Roles held by the contact"
					},
					"categories": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"description": "Categories assigned to the contact"
					},
					"parentContactId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Parent contact ID for hierarchical contacts"
					},
					"isPrimary": {
						"type": "boolean",
						"description": "Whether this is the primary contact for the parent"
					},
					"metadata": {
						"type": "object",
						"additionalProperties": {},
						"description": "Custom metadata key-value pairs"
					},
					"allowDuplicateEmail": {
						"type": "boolean",
						"description": "Confirm that this contact deliberately shares its email address with an existing active contact (e.g. a couple). Without it such a create is refused with 409; with it the acknowledgement is recorded in the new contact's metadata."
					}
				},
				"required": ["kind", "private"]
			},
			"CreateBusinessContactRequest": {
				"type": "object",
				"properties": {
					"kind": {
						"type": "string",
						"enum": ["business"],
						"example": "business"
					},
					"business": {
						"type": "object",
						"properties": {
							"companyName": {
								"type": "string",
								"minLength": 1,
								"example": "Müller Solar AG",
								"description": "Company name (required)"
							},
							"email": {
								"type": "string",
								"example": "hans.mueller@example.ch"
							},
							"phone": {
								"type": "string",
								"example": "+41 79 123 45 67"
							},
							"website": {
								"type": "string",
								"example": "https://mueller-solar.ch"
							},
							"street": {
								"type": "string",
								"example": "Bahnhofstrasse"
							},
							"houseNumber": {
								"type": "string",
								"example": "10"
							},
							"addressLine1": {
								"type": "string",
								"example": "c/o Müller"
							},
							"addressLine2": {
								"type": "string",
								"example": "2. Stock"
							},
							"zip": {
								"type": "string",
								"example": "8001"
							},
							"city": {
								"type": "string",
								"example": "Zürich"
							},
							"country": {
								"type": "string",
								"example": "CH"
							}
						},
						"required": ["companyName"],
						"description": "Business contact data"
					},
					"roles": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"description": "Roles held by the contact"
					},
					"categories": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"description": "Categories assigned to the contact"
					},
					"parentContactId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Parent contact ID for hierarchical contacts"
					},
					"isPrimary": {
						"type": "boolean",
						"description": "Whether this is the primary contact for the parent"
					},
					"metadata": {
						"type": "object",
						"additionalProperties": {},
						"description": "Custom metadata key-value pairs"
					},
					"allowDuplicateEmail": {
						"type": "boolean",
						"description": "Confirm that this contact deliberately shares its email address with an existing active contact (e.g. a couple). Without it such a create is refused with 409; with it the acknowledgement is recorded in the new contact's metadata."
					}
				},
				"required": ["kind", "business"]
			},
			"CreateContactRequest": {
				"anyOf": [
					{
						"$ref": "#/components/schemas/CreatePrivateContactRequest"
					},
					{
						"$ref": "#/components/schemas/CreateBusinessContactRequest"
					}
				],
				"description": "Create a new contact (private or business)"
			},
			"UpdateContactRequest": {
				"type": "object",
				"properties": {
					"kind": {
						"type": "string",
						"enum": ["private", "business"],
						"example": "private",
						"description": "Type of contact"
					},
					"private": {
						"type": "object",
						"properties": {
							"lastName": {
								"type": "string",
								"minLength": 1
							},
							"salutation": {
								"type": "string",
								"example": "Herr"
							},
							"academicTitle": {
								"type": "string",
								"example": "Dr."
							},
							"firstName": {
								"type": "string",
								"example": "Hans"
							},
							"email": {
								"type": "string",
								"example": "hans.mueller@example.ch"
							},
							"phone": {
								"type": "string",
								"example": "+41 79 123 45 67"
							},
							"website": {
								"type": "string",
								"example": "https://mueller-solar.ch"
							},
							"street": {
								"type": "string",
								"example": "Bahnhofstrasse"
							},
							"houseNumber": {
								"type": "string",
								"example": "10"
							},
							"addressLine1": {
								"type": "string",
								"example": "c/o Müller"
							},
							"addressLine2": {
								"type": "string",
								"example": "2. Stock"
							},
							"zip": {
								"type": "string",
								"example": "8001"
							},
							"city": {
								"type": "string",
								"example": "Zürich"
							},
							"country": {
								"type": "string",
								"example": "CH"
							},
							"language": {
								"type": "string",
								"example": "de"
							}
						},
						"description": "Private contact data updates"
					},
					"business": {
						"type": "object",
						"properties": {
							"companyName": {
								"type": "string",
								"minLength": 1
							},
							"email": {
								"type": "string",
								"example": "hans.mueller@example.ch"
							},
							"phone": {
								"type": "string",
								"example": "+41 79 123 45 67"
							},
							"website": {
								"type": "string",
								"example": "https://mueller-solar.ch"
							},
							"street": {
								"type": "string",
								"example": "Bahnhofstrasse"
							},
							"houseNumber": {
								"type": "string",
								"example": "10"
							},
							"addressLine1": {
								"type": "string",
								"example": "c/o Müller"
							},
							"addressLine2": {
								"type": "string",
								"example": "2. Stock"
							},
							"zip": {
								"type": "string",
								"example": "8001"
							},
							"city": {
								"type": "string",
								"example": "Zürich"
							},
							"country": {
								"type": "string",
								"example": "CH"
							}
						},
						"description": "Business contact data updates"
					},
					"metadata": {
						"type": "object",
						"additionalProperties": {}
					}
				}
			},
			"ContactResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/Contact"
					}
				},
				"required": ["data"]
			},
			"ContactsListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Contact"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"Task": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this task belongs to"
					},
					"projectId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project this task belongs to"
					},
					"project": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/TaskProjectRef"
							},
							{
								"type": "null"
							}
						],
						"description": "Project reference (null on create)"
					},
					"title": {
						"type": "string",
						"example": "connectionRequest",
						"description": "Stored task title as plain text. For a standard (template) task this is the stable template key (e.g. `connectionRequest`) or empty; use `displayTitle` for the name the app shows."
					},
					"displayTitle": {
						"type": "string",
						"example": "Anschlussgesuch",
						"description": "Task name as the app shows it: for a standard (template) task its translated name in the requested `locale` (default: the caller’s language, else de); for a task with its own title the same text as `title`."
					},
					"template": {
						"type": "string",
						"example": "custom",
						"description": "Task template identifier (custom for tasks created without a template)"
					},
					"description": {
						"type": ["string", "null"],
						"example": "Inspect roof for solar panel installation suitability",
						"description": "Task description as plain text"
					},
					"statusId": {
						"type": "string",
						"enum": [
							"open",
							"workInProgress",
							"waitingForExternalFeedback",
							"waitingForInternalFeedback",
							"waitingForCustomerFeedback",
							"dateSet",
							"ordered",
							"completed"
						],
						"example": "open",
						"description": "Current status of the task (system key of its workflow status)"
					},
					"stageId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project stage this task belongs to"
					},
					"assigneeId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team member (user) ID"
					},
					"teamId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team ID (when assigned to a team)"
					},
					"priority": {
						"type": ["string", "null"],
						"enum": ["low", "medium", "high", "urgent", null],
						"example": "medium",
						"description": "Task priority"
					},
					"position": {
						"type": ["integer", "null"],
						"example": 1,
						"description": "Position in the task list (for ordering)"
					},
					"deadline": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "Task deadline (ISO 8601 datetime)"
					},
					"reminderAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "The authenticated user's pending reminder on this task (ISO 8601 datetime); null when none is set. Reminders are per user: an API key reads and writes the reminder of the user who owns the key."
					},
					"gridOperatorForm": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/GridOperatorForm"
							},
							{
								"type": "null"
							}
						],
						"description": "Status of the EFSolar / grid-operator form linked to this task, as last synced in the app; null when the task has no ElektroForm document (a project-wide sync does not link the other tasks)."
					},
					"checklistItems": {
						"type": ["array", "null"],
						"items": {
							"$ref": "#/components/schemas/ChecklistItem"
						},
						"deprecated": true,
						"description": "Deprecated (sunset 2027-11-09). Read-only view of the task checklist, built from its checklist subtasks; null when the task has none. Will be removed from the response after the sunset date."
					},
					"enabled": {
						"type": "boolean",
						"example": true,
						"description": "Whether the task is enabled (soft delete)"
					},
					"customerViewable": {
						"type": "boolean",
						"example": false,
						"description": "Whether the customer sees the task"
					},
					"createdAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					}
				},
				"required": [
					"id",
					"accountId",
					"projectId",
					"project",
					"title",
					"displayTitle",
					"template",
					"description",
					"statusId",
					"stageId",
					"assigneeId",
					"teamId",
					"priority",
					"position",
					"deadline",
					"reminderAt",
					"gridOperatorForm",
					"checklistItems",
					"enabled",
					"customerViewable",
					"createdAt",
					"updatedAt",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"TaskProjectRef": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"internalReference": {
						"type": ["string", "null"],
						"example": "Müller – Bahnhofstrasse 10"
					}
				},
				"required": ["id", "internalReference"],
				"additionalProperties": false
			},
			"GridOperatorForm": {
				"type": "object",
				"properties": {
					"provider": {
						"type": "string",
						"enum": ["elektroform"],
						"example": "elektroform",
						"description": "The grid-operator form provider (`elektroform` is EFSolar / ElektroForm Solar)"
					},
					"status": {
						"type": ["string", "null"],
						"enum": [
							"open",
							"workInProgress",
							"waitingForExternalFeedback",
							"waitingForInternalFeedback",
							"waitingForCustomerFeedback",
							"dateSet",
							"ordered",
							"completed",
							null
						],
						"example": "open",
						"description": "Progress of the linked form as a task status: the furthest-progressed document wins. Null when no stored document has a Solarstream equivalent."
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the status was last synced from the provider. It is refreshed only when someone presses the sync button on the task in the app; there is no scheduled sync."
					}
				},
				"required": ["provider", "status", "updatedAt"],
				"additionalProperties": false
			},
			"ChecklistItem": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"example": "item-1",
						"description": "Unique ID for the checklist item"
					},
					"label": {
						"type": "string",
						"example": "Check roof measurements",
						"description": "Checklist item text"
					},
					"checked": {
						"type": "boolean",
						"example": false,
						"description": "Whether the item is completed"
					},
					"lastUpdated": {
						"type": ["number", "null"],
						"example": 1705312800000,
						"description": "Timestamp of last update (Unix milliseconds)"
					}
				},
				"required": ["id", "label", "checked", "lastUpdated"],
				"additionalProperties": false
			},
			"UpdateTaskRequest": {
				"type": "object",
				"properties": {
					"title": {
						"type": "string",
						"minLength": 1,
						"maxLength": 500
					},
					"description": {
						"type": ["string", "null"],
						"maxLength": 5000,
						"description": "Task description (plain text)"
					},
					"statusId": {
						"type": "string",
						"enum": [
							"open",
							"workInProgress",
							"waitingForExternalFeedback",
							"waitingForInternalFeedback",
							"waitingForCustomerFeedback",
							"dateSet",
							"ordered",
							"completed"
						],
						"example": "open",
						"description": "Current status of the task (system key of its workflow status)"
					},
					"assigneeId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"teamId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"priority": {
						"type": ["string", "null"],
						"enum": ["low", "medium", "high", "urgent", null],
						"example": "medium",
						"description": "Task priority (null to clear). Rejected with 422 for a task whose type has no priority, e.g. a checklist item."
					},
					"deadline": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "Task deadline (ISO 8601 datetime, null to clear)"
					},
					"reminderAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"description": "Sets (ISO 8601 datetime with a Z or UTC offset) or clears (null) the authenticated user's reminder on the task. Each user has one pending reminder per task; setting a new one replaces it. The reminder fires as an in-app, email or push notification at that moment."
					},
					"customerViewable": {
						"type": "boolean"
					},
					"enabled": {
						"type": "boolean",
						"description": "Enable/disable task (soft delete)"
					},
					"checklistItems": {
						"type": "array",
						"items": {
							"type": "object",
							"additionalProperties": {}
						},
						"deprecated": true,
						"description": "Deprecated and ignored: checklist items are subtasks and cannot be replaced through this field. Sending it still regenerates the status suggestion and the response carries the real checklist. Accepted (not rejected) until the 2027-11-09 sunset."
					}
				}
			},
			"TaskResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/Task"
					}
				},
				"required": ["data"]
			},
			"TasksListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Task"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"TeamMember": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"userId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "The user ID associated with this team member"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this team member belongs to"
					},
					"role": {
						"type": "string",
						"enum": ["owner", "admin", "member"],
						"example": "member",
						"description": "Role of the team member within the account"
					},
					"accessProfiles": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"example": ["installer"],
						"description": "Access profiles assigned to the member (at most one)"
					},
					"metadata": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/TeamMemberMetadata"
							},
							{
								"type": "null"
							}
						],
						"description": "Additional metadata for the team member"
					},
					"settingsData": {
						"anyOf": [
							{
								"$ref": "#/components/schemas/TeamMemberSettingsData"
							},
							{
								"type": "null"
							}
						],
						"description": "User-specific settings within the account"
					},
					"createdAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the team member was archived (soft deleted)"
					}
				},
				"required": [
					"id",
					"userId",
					"accountId",
					"role",
					"accessProfiles",
					"metadata",
					"settingsData",
					"createdAt",
					"updatedAt",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"TeamMemberMetadata": {
				"type": "object",
				"properties": {
					"fullName": {
						"type": "string",
						"example": "Hans Müller"
					},
					"jobTitle": {
						"type": ["string", "null"],
						"example": "Project Manager"
					},
					"email": {
						"type": ["string", "null"],
						"example": "hans.mueller@example.ch"
					},
					"phone": {
						"type": ["string", "null"],
						"example": "+41 79 123 45 67"
					},
					"color": {
						"type": ["integer", "null"],
						"description": "Planner palette index"
					}
				},
				"additionalProperties": {}
			},
			"TeamMemberSettingsData": {
				"type": "object",
				"properties": {
					"betaOptIn": {
						"type": "boolean",
						"example": false,
						"description": "Whether the team member opted into next-release beta features"
					},
					"notifications": {
						"type": "object",
						"properties": {
							"email": {
								"type": "boolean"
							},
							"push": {
								"type": "boolean"
							}
						}
					},
					"preferences": {
						"type": "object",
						"additionalProperties": {}
					}
				},
				"additionalProperties": {}
			},
			"InviteTeamMemberRequest": {
				"type": "object",
				"properties": {
					"email": {
						"type": "string",
						"format": "email",
						"example": "anna.meier@example.ch",
						"description": "Email address to invite (required)"
					},
					"role": {
						"type": "string",
						"enum": ["owner", "admin", "member"],
						"example": "member",
						"description": "Role the invitee gets on acceptance (required): 'owner', 'admin' or 'member'. Only an owner can invite an owner."
					},
					"accessProfileId": {
						"type": "string",
						"minLength": 1,
						"example": "installer",
						"description": "Access profile applied on acceptance (required): a system profile id (e.g. full_access, sales, installer) or a custom profile id of this account. You can only assign a profile you could assign in the app."
					},
					"language": {
						"type": "string",
						"enum": ["en", "de", "fr", "it"],
						"example": "de",
						"description": "Language of the invitation email. Defaults to the request locale."
					}
				},
				"required": ["email", "role", "accessProfileId"]
			},
			"TeamMemberInvitation": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Invitation ID"
					},
					"email": {
						"type": "string",
						"example": "anna.meier@example.ch"
					},
					"role": {
						"type": "string",
						"enum": ["owner", "admin", "member"],
						"example": "member",
						"description": "Role of the team member within the account"
					},
					"accessProfileId": {
						"type": ["string", "null"],
						"example": "installer"
					},
					"status": {
						"type": "string",
						"enum": ["pending"],
						"description": "Always pending: the invitee has not accepted yet"
					}
				},
				"required": ["id", "email", "role", "accessProfileId", "status"],
				"additionalProperties": false
			},
			"TeamMemberInvitationResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/TeamMemberInvitation"
					}
				},
				"required": ["data"]
			},
			"UpdateTeamMemberRequest": {
				"type": "object",
				"properties": {
					"role": {
						"type": "string",
						"enum": ["owner", "admin", "member"],
						"example": "member",
						"description": "New role for the team member. The role and every other field in the request are written in one transaction: if any part is refused (403) or fails, nothing changes."
					},
					"metadata": {
						"allOf": [
							{
								"$ref": "#/components/schemas/TeamMemberMetadata"
							},
							{
								"description": "Updated metadata (merged with existing)"
							}
						]
					},
					"settingsData": {
						"allOf": [
							{
								"$ref": "#/components/schemas/TeamMemberSettingsData"
							},
							{
								"description": "Updated settings data (merged with existing)"
							}
						]
					},
					"accessProfiles": {
						"type": "array",
						"items": {
							"type": "string"
						},
						"maxItems": 1,
						"description": "Access profile to assign (at most one; you can only assign profiles you hold yourself)"
					}
				}
			},
			"TeamMemberResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/TeamMember"
					}
				},
				"required": ["data"]
			},
			"TeamMembersListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/TeamMember"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"File": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this file belongs to"
					},
					"projectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated project ID (if any)"
					},
					"taskId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated task ID (if any)"
					},
					"contactId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated contact ID (if any)"
					},
					"leadId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated lead ID (if any)"
					},
					"name": {
						"type": "string",
						"example": "solar-panel-layout.pdf",
						"description": "File name with extension"
					},
					"storagePath": {
						"type": ["string", "null"],
						"example": "accounts/123/projects/456/documents/solar-panel-layout.pdf",
						"description": "Path in the storage bucket"
					},
					"type": {
						"type": "string",
						"example": "application/pdf",
						"description": "MIME type of the file"
					},
					"size": {
						"type": "integer",
						"example": 1048576,
						"description": "File size in bytes"
					},
					"category": {
						"type": ["string", "null"],
						"example": "sitePlan",
						"description": "File category for organization"
					},
					"customerVisible": {
						"type": "boolean",
						"example": false,
						"description": "Whether the file is visible to customers on the status page"
					},
					"createdBy": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "User ID that created the file record"
					},
					"updatedBy": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "User ID that last updated the file record"
					},
					"createdAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the file was archived (soft deleted)"
					}
				},
				"required": [
					"id",
					"accountId",
					"projectId",
					"taskId",
					"contactId",
					"leadId",
					"name",
					"storagePath",
					"type",
					"size",
					"category",
					"customerVisible",
					"createdBy",
					"updatedBy",
					"createdAt",
					"updatedAt",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"CreateFileRequest": {
				"type": "object",
				"properties": {
					"name": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "solar-panel-layout.pdf",
						"description": "File name with extension (required)"
					},
					"storagePath": {
						"type": "string",
						"minLength": 1,
						"example": "uploads/solar-panel-layout.pdf",
						"description": "Key of an object that already exists in the account bucket, directly under `uploads/` (required). The request is rejected when no object is stored there, when the key is a derived image variant or version, or when another file already owns it. To upload new bytes use POST /api/v1/files/uploads instead."
					},
					"type": {
						"type": "string",
						"example": "application/pdf",
						"description": "MIME type of the file. Must be the stored object's Content-Type (default: the stored object's own)"
					},
					"size": {
						"type": "integer",
						"minimum": 0,
						"example": 1048576,
						"description": "File size in bytes (default: the stored object's size; when given it must match it)"
					},
					"projectId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated project ID"
					},
					"taskId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated task ID"
					},
					"contactId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated contact ID"
					},
					"leadId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Associated lead ID"
					},
					"category": {
						"type": "string",
						"example": "sitePlan",
						"description": "File category id: a built-in category or one the account created. List the valid ids with GET /api/v1/files/categories; any other value is rejected."
					},
					"customerVisible": {
						"type": "boolean",
						"description": "Whether the file is visible to customers on the status page (default: false)"
					}
				},
				"required": ["name", "storagePath"]
			},
			"UpdateFileRequest": {
				"type": "object",
				"properties": {
					"name": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "solar-panel-layout-v2.pdf",
						"description": "Updated file name"
					},
					"category": {
						"type": ["string", "null"],
						"example": "sitePlan",
						"description": "Updated file category (set to null to clear)"
					},
					"projectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Move the file to another project"
					},
					"customerVisible": {
						"type": "boolean",
						"description": "Update customer visibility"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "Set to archive/unarchive the file"
					}
				}
			},
			"BulkDeleteFilesRequest": {
				"type": "object",
				"properties": {
					"ids": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"minItems": 1,
						"example": ["550e8400-e29b-41d4-a716-446655440000", "550e8400-e29b-41d4-a716-446655440001"],
						"description": "Array of file IDs to delete"
					}
				},
				"required": ["ids"]
			},
			"FileResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/File"
					}
				},
				"required": ["data"]
			},
			"FilesListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/File"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"FileDownloadUrl": {
				"type": "object",
				"properties": {
					"url": {
						"type": "string",
						"format": "uri",
						"example": "https://storage.solarstream.ch/object/sign/acc/uploads/file.pdf?token=…",
						"description": "Signed URL that downloads the file contents without further authentication"
					},
					"expiresIn": {
						"type": "integer",
						"example": 300,
						"description": "Seconds the URL stays valid"
					},
					"expiresAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the URL stops working"
					}
				},
				"required": ["url", "expiresIn", "expiresAt"],
				"additionalProperties": false
			},
			"FileDownloadUrlResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/FileDownloadUrl"
					}
				},
				"required": ["data"]
			},
			"CreateFileUploadRequest": {
				"type": "object",
				"properties": {
					"name": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "roof-photo.jpg",
						"description": "File name with extension (required)"
					},
					"type": {
						"type": "string",
						"minLength": 1,
						"example": "image/jpeg",
						"description": "MIME type of the file (required). Must be a type the app accepts for uploads."
					},
					"size": {
						"type": "integer",
						"exclusiveMinimum": 0,
						"example": 2457600,
						"description": "Exact size of the file in bytes (required, at most 1 GiB). The completion rejects an upload of any other size."
					},
					"projectId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project the file belongs to"
					},
					"taskId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Task the file belongs to"
					},
					"contactId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact the file belongs to"
					},
					"leadId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Lead the file belongs to"
					},
					"category": {
						"type": ["string", "null"],
						"example": "sitePlan",
						"description": "File category id: a built-in category or one the account created. List the valid ids with GET /api/v1/files/categories; any other value is rejected."
					},
					"customerVisible": {
						"type": "boolean",
						"description": "Whether the file is visible to customers on the status page (default: false)"
					}
				},
				"required": ["name", "type", "size"],
				"additionalProperties": false
			},
			"FileUpload": {
				"type": "object",
				"properties": {
					"fileId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Id of the reserved file. It stays invisible until the upload is completed."
					},
					"uploadUrl": {
						"type": "string",
						"format": "uri",
						"example": "https://storage.solarstream.ch/storage/v1/object/upload/sign/acc/uploads/file?token=…",
						"description": "Signed URL. PUT the raw file bytes here, with the `headers` below. No further authentication."
					},
					"method": {
						"type": "string",
						"enum": ["PUT"],
						"description": "HTTP method for the upload"
					},
					"headers": {
						"type": "object",
						"additionalProperties": {
							"type": "string"
						},
						"example": {
							"Content-Type": "image/jpeg"
						},
						"description": "Headers to send with the upload"
					},
					"expiresIn": {
						"type": "integer",
						"example": 7200,
						"description": "Seconds the upload URL stays valid"
					},
					"expiresAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "When the upload URL stops working"
					}
				},
				"required": ["fileId", "uploadUrl", "method", "headers", "expiresIn", "expiresAt"],
				"additionalProperties": false
			},
			"FileUploadResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/FileUpload"
					}
				},
				"required": ["data"]
			},
			"FileCategory": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"example": "sitePlan",
						"description": "The value to send as a file `category`"
					},
					"title": {
						"type": "string",
						"example": "Situationsplan",
						"description": "Display name"
					},
					"description": {
						"type": ["string", "null"],
						"description": "Description, for categories the account created"
					},
					"system": {
						"type": "boolean",
						"description": "true for a built-in Solarstream category, false for one the account created"
					}
				},
				"required": ["id", "title", "description", "system"],
				"additionalProperties": false
			},
			"FileCategoriesResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/FileCategory"
						}
					}
				},
				"required": ["data"]
			},
			"Comment": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this comment belongs to"
					},
					"projectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project this comment belongs to (also set for task comments: the task’s project)"
					},
					"taskId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Task this comment is attached to (if any)"
					},
					"leadId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Lead this comment is attached to (if any)"
					},
					"contactId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact this comment is attached to (if any)"
					},
					"content": {
						"type": "string",
						"example": "The roof inspection showed good conditions for solar panel installation.",
						"description": "Comment text (plain text; one line per paragraph)"
					},
					"assigneeIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Mentioned team member ids (`id` from list_team_members / GET /api/v1/team-members, not `userId`); they are notified"
					},
					"isPrivate": {
						"type": "boolean",
						"example": true,
						"description": "true: internal team comment. false: a message sent to the customer"
					},
					"isReadBy": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Team member ids who have read this comment"
					},
					"createdBy": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "User ID that created the comment"
					},
					"updatedBy": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "User ID that last updated the comment"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					}
				},
				"required": [
					"id",
					"accountId",
					"projectId",
					"taskId",
					"leadId",
					"contactId",
					"content",
					"assigneeIds",
					"isPrivate",
					"isReadBy",
					"createdBy",
					"updatedBy",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"CreateCommentRequest": {
				"type": "object",
				"properties": {
					"projectId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project to attach the comment to. At least one of projectId, taskId, leadId or contactId is required."
					},
					"taskId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Task to attach the comment to (without projectId, the task’s project is used)"
					},
					"leadId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Lead to attach the comment to"
					},
					"contactId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact to attach the comment to"
					},
					"content": {
						"type": "string",
						"minLength": 1,
						"maxLength": 10000,
						"example": "The roof inspection showed good conditions for solar panel installation.",
						"description": "Comment text, plain (required). Each line becomes a paragraph."
					},
					"assigneeIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "team member ids (`id` from list_team_members / GET /api/v1/team-members, not `userId`) to mention; each one is notified. Unknown ids are rejected (400)."
					},
					"isPrivate": {
						"type": "boolean",
						"example": true,
						"description": "true (default): internal team comment. false: the comment is SENT TO THE CUSTOMER"
					}
				},
				"required": ["content"]
			},
			"UpdateCommentRequest": {
				"type": "object",
				"properties": {
					"content": {
						"type": "string",
						"minLength": 1,
						"maxLength": 10000,
						"description": "New comment text, plain. Each line becomes a paragraph."
					},
					"assigneeIds": {
						"type": ["array", "null"],
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Mentioned team member ids (`id` from list_team_members / GET /api/v1/team-members, not `userId`) (null to clear). Unknown ids are rejected (400)."
					},
					"isPrivate": {
						"type": "boolean",
						"description": "true: internal team comment. false: the comment is sent to the customer"
					},
					"isReadBy": {
						"type": ["array", "null"],
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Team member ids who have read the comment (read receipts)"
					}
				}
			},
			"CommentResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/Comment"
					}
				},
				"required": ["data"]
			},
			"CommentsListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Comment"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"NoteAttachment": {
				"type": "object",
				"properties": {
					"fileId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "File id; GET /api/v1/files/{id} returns its metadata and /download-url a signed download link"
					},
					"kind": {
						"type": "string",
						"enum": ["image", "file"],
						"description": "`image`: an image block. `file`: an inline document"
					},
					"name": {
						"type": "string",
						"example": "roof-north.jpg",
						"description": "File name the note was written with"
					},
					"mimeType": {
						"type": ["string", "null"],
						"example": "application/pdf",
						"description": "MIME type the note was written with (documents only; null for images and when not recorded)"
					}
				},
				"required": ["fileId", "kind", "name", "mimeType"],
				"additionalProperties": false
			},
			"Note": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"accountId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Account this note belongs to"
					},
					"level": {
						"type": "string",
						"enum": ["project", "stage", "task"],
						"description": "What the note hangs off: `project` (the project’s own note), `stage` (a project stage’s note) or `task` (a task’s note)"
					},
					"projectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project of a project note, and the project a stage belongs to for a stage note. Null for a task note"
					},
					"taskId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Task or stage the note hangs off. Null for a project note"
					},
					"content": {
						"type": "string",
						"example": "Scaffolding needed on the north side; neighbour has the key.",
						"description": "Note text (plain text; one line per paragraph). Embedded files are listed in `attachments`"
					},
					"attachments": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/NoteAttachment"
						},
						"description": "The images and documents the note embeds, in document order, one entry per file"
					},
					"createdBy": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "User ID that created the note"
					},
					"updatedBy": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "User ID that last updated the note"
					},
					"createdAt": {
						"type": "string",
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2024-01-15T10:30:00.000Z",
						"description": "ISO 8601 datetime string"
					}
				},
				"required": [
					"id",
					"accountId",
					"level",
					"projectId",
					"taskId",
					"content",
					"attachments",
					"createdBy",
					"updatedBy",
					"createdAt",
					"updatedAt"
				],
				"additionalProperties": false
			},
			"NoteResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/Note"
					}
				},
				"required": ["data"]
			},
			"NotesListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Note"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"SearchResult": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "ID of the matched resource (fetch it from its own endpoint)"
					},
					"type": {
						"type": "string",
						"enum": ["project", "contact", "file", "lead"],
						"example": "project",
						"description": "Type of the matched resource"
					},
					"title": {
						"type": "string",
						"example": "P-2024-0042 Müller – Bahnhofstrasse 10",
						"description": "Display text: project number and reference, contact or company name, file name, lead title"
					},
					"projectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Project the resource belongs to (projects and project files), otherwise null"
					}
				},
				"required": ["id", "type", "title", "projectId"],
				"additionalProperties": false
			},
			"SearchResultsResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/SearchResult"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"ScheduleEvent": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"title": {
						"type": "string",
						"example": "",
						"description": "The event’s own title as entered in the planner: an optional override, usually empty. Use `displayTitle` for the name of the event."
					},
					"displayTitle": {
						"type": "string",
						"example": "Montage – PER-151 – Müller, Bern",
						"description": "The label the resource planner shows on the event’s bar: a project event shows the project title (in the account’s title composition), a lead event the lead short title, an absence or appointment its category (e.g. «Krankheit», in the requested `locale`). An own `title` is prefixed («Own title – Project title»); a lead event with its own title shows only that."
					},
					"category": {
						"type": "string",
						"example": "Project",
						"description": "Event category: `Project`, `Meetings`, `Absence` or `Other`"
					},
					"subcategory": {
						"type": ["string", "null"],
						"example": "vacation",
						"description": "Category-specific subtype"
					},
					"status": {
						"type": "string",
						"enum": ["fixed", "preliminary"],
						"description": "Whether the slot is confirmed"
					},
					"startAt": {
						"type": "string",
						"format": "date-time",
						"example": "2026-11-12T07:00:00+00:00"
					},
					"endAt": {
						"type": "string",
						"format": "date-time",
						"example": "2026-11-12T07:00:00+00:00"
					},
					"remark": {
						"type": ["string", "null"]
					},
					"color": {
						"type": ["integer", "null"],
						"description": "Planner palette index (1–16)"
					},
					"eventType": {
						"type": ["string", "null"],
						"example": "project",
						"description": "standalone, team, resource, project, project-stage or project-task"
					},
					"isTeamEvent": {
						"type": "boolean"
					},
					"parentEventId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Team event this event belongs to"
					},
					"childEventIds": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Events of this team event (empty otherwise)"
					},
					"linkedProjectId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"linkedLeadId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"linkedStageId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"linkedStageName": {
						"type": ["string", "null"],
						"description": "Linked stage name in the requested locale"
					},
					"linkedTaskId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"linkedTaskName": {
						"type": ["string", "null"],
						"description": "Linked task name in the requested locale"
					},
					"linkedSectionId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Unique identifier (UUID v4)"
					},
					"linkedSectionName": {
						"type": ["string", "null"]
					},
					"assignedUsers": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Assigned users (user or team-member ids)"
					},
					"assignedResources": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Assigned planner resources"
					},
					"assignedContacts": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Assigned contacts"
					},
					"assignedTeams": {
						"type": "array",
						"items": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Unique identifier (UUID v4)"
						},
						"description": "Assigned teams"
					},
					"createdAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2026-11-12T07:00:00+00:00"
					},
					"updatedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2026-11-12T07:00:00+00:00"
					},
					"archivedAt": {
						"type": ["string", "null"],
						"format": "date-time",
						"example": "2026-11-12T07:00:00+00:00"
					}
				},
				"required": [
					"id",
					"title",
					"displayTitle",
					"category",
					"subcategory",
					"status",
					"startAt",
					"endAt",
					"remark",
					"color",
					"eventType",
					"isTeamEvent",
					"parentEventId",
					"childEventIds",
					"linkedProjectId",
					"linkedLeadId",
					"linkedStageId",
					"linkedStageName",
					"linkedTaskId",
					"linkedTaskName",
					"linkedSectionId",
					"linkedSectionName",
					"assignedUsers",
					"assignedResources",
					"assignedContacts",
					"assignedTeams",
					"createdAt",
					"updatedAt",
					"archivedAt"
				],
				"additionalProperties": false
			},
			"ScheduleEventsResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ScheduleEvent"
						}
					}
				},
				"required": ["data"]
			},
			"LeadAddress": {
				"type": "object",
				"properties": {
					"street": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "Bahnhofstrasse"
					},
					"houseNumber": {
						"type": "string",
						"maxLength": 50,
						"example": "10"
					},
					"zip": {
						"type": "string",
						"minLength": 1,
						"maxLength": 20,
						"example": "8001"
					},
					"city": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "Zürich"
					},
					"country": {
						"type": "string",
						"minLength": 2,
						"maxLength": 2,
						"example": "CH",
						"description": "ISO 3166-1 alpha-2 country code (default: CH)"
					}
				},
				"required": ["street", "zip", "city"]
			},
			"CreateLeadRequest": {
				"type": "object",
				"properties": {
					"title": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "Müller – PV Einfamilienhaus",
						"description": "Lead title. Must differ from the title of every other active lead (case and spacing ignored); a lead keeping its own title is fine."
					},
					"customerContactId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Contact ID of the customer (`Contact.id`; create one with `POST /api/v1/contacts`)"
					},
					"address": {
						"$ref": "#/components/schemas/LeadAddress"
					},
					"columnId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Pipeline column to start in — an `id` from `GET /api/v1/lead-columns` (default: the first active column)"
					},
					"internalReference": {
						"type": "string",
						"maxLength": 255,
						"description": "Internal reference / label"
					},
					"estimatedValue": {
						"type": "number",
						"minimum": 0,
						"maximum": 9999999999,
						"example": 32000,
						"description": "Estimated value (CHF)"
					},
					"priority": {
						"type": "string",
						"enum": ["low", "medium", "high", "urgent"],
						"example": "medium",
						"description": "Lead priority"
					},
					"source": {
						"type": "string",
						"maxLength": 100,
						"example": "website",
						"description": "Where the lead came from"
					},
					"sourceDetails": {
						"type": "string",
						"maxLength": 2000,
						"description": "Free-text detail on the source"
					},
					"assigneeId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team member: `TeamMember.id` from `GET /api/v1/team-members`, not its `userId`"
					},
					"deadline": {
						"type": "string",
						"format": "date",
						"example": "2024-01-15",
						"description": "Submission deadline (Eingabefrist)"
					}
				},
				"required": ["title", "customerContactId", "address"]
			},
			"UpdateLeadRequest": {
				"type": "object",
				"properties": {
					"title": {
						"type": "string",
						"minLength": 1,
						"maxLength": 255,
						"example": "Müller – PV Einfamilienhaus",
						"description": "Lead title. Must differ from the title of every other active lead (case and spacing ignored); a lead keeping its own title is fine."
					},
					"internalReference": {
						"type": ["string", "null"],
						"maxLength": 255,
						"description": "Internal reference / label"
					},
					"estimatedValue": {
						"type": ["number", "null"],
						"minimum": 0,
						"maximum": 9999999999,
						"example": 32000,
						"description": "Estimated value (CHF)"
					},
					"priority": {
						"type": ["string", "null"],
						"enum": ["low", "medium", "high", "urgent", null],
						"example": "medium",
						"description": "Lead priority"
					},
					"source": {
						"type": ["string", "null"],
						"maxLength": 100,
						"example": "website",
						"description": "Where the lead came from"
					},
					"sourceDetails": {
						"type": ["string", "null"],
						"maxLength": 2000,
						"description": "Free-text detail on the source"
					},
					"assigneeId": {
						"type": ["string", "null"],
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Assigned team member: `TeamMember.id` from `GET /api/v1/team-members`, not its `userId`"
					},
					"deadline": {
						"type": ["string", "null"],
						"format": "date",
						"example": "2024-01-15",
						"description": "Submission deadline (Eingabefrist)"
					},
					"status": {
						"type": "string",
						"enum": ["active", "won", "lost", "archived"],
						"example": "active",
						"description": "Move the lead: won / lost (into the first won/lost column unless `columnId` names one), archived, or active (restores an archived lead; reopens a won/lost lead into `columnId` or the first active column)"
					},
					"columnId": {
						"type": "string",
						"format": "uuid",
						"example": "550e8400-e29b-41d4-a716-446655440000",
						"description": "Move the lead to this pipeline column; its column type sets the status"
					},
					"lostReason": {
						"type": ["string", "null"],
						"maxLength": 2000,
						"description": "Reason when the lead becomes lost"
					}
				}
			},
			"LeadResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/Lead"
					}
				},
				"required": ["data"]
			},
			"LeadsListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Lead"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			},
			"LeadColumnsResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/LeadColumn"
						}
					}
				},
				"required": ["data"]
			},
			"OfferResponse": {
				"type": "object",
				"properties": {
					"data": {
						"$ref": "#/components/schemas/Offer"
					}
				},
				"required": ["data"]
			},
			"OffersListResponse": {
				"type": "object",
				"properties": {
					"data": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/Offer"
						}
					},
					"meta": {
						"$ref": "#/components/schemas/PaginationMeta"
					}
				},
				"required": ["data", "meta"]
			}
		},
		"parameters": {}
	},
	"paths": {
		"/api/v1/health": {
			"get": {
				"tags": ["Health"],
				"summary": "Check API health",
				"description": "Returns the current health status of the API. Does not require authentication.",
				"security": [],
				"responses": {
					"200": {
						"description": "API is healthy",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/HealthResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/accounts": {
			"get": {
				"tags": ["Accounts"],
				"summary": "List accounts",
				"description": "Lists the company accounts the authenticated user belongs to (the personal account holds no data and is not listed). Needs no `X-Account-Id`.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"responses": {
					"200": {
						"description": "Accounts of the calling user",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"data": {
											"type": "array",
											"items": {
												"$ref": "#/components/schemas/AccountMembership"
											}
										}
									},
									"required": ["data"]
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/projects": {
			"get": {
				"tags": ["Projects"],
				"summary": "List projects",
				"description": "Returns a paginated list of projects for the authenticated account, newest change first. Archived projects are excluded unless `archived` says otherwise. Supports filtering by stage and a text search.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["in_sale", "in_installation", "completed"],
							"example": "in_sale",
							"description": "Filter by project stage"
						},
						"required": false,
						"description": "Filter by project stage",
						"name": "stage",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["true", "false", "only"],
							"example": "false",
							"description": "Archived filter: false (default, active projects only), true (active and archived), only (archived only)"
						},
						"required": false,
						"description": "Archived filter: false (default, active projects only), true (active and archived), only (archived only)",
						"name": "archived",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"example": "Müller",
							"description": "Case-insensitive match on project number, internal reference and description"
						},
						"required": false,
						"description": "Case-insensitive match on project number, internal reference and description",
						"name": "search",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of projects",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProjectsListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"post": {
				"tags": ["Projects"],
				"summary": "Create a project",
				"description": "Creates a project the same way the app does: from a project template (its stages and tasks), with a customer contact and an installation address. Fields outside the request schema are ignored.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateProjectRequest"
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Project created successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProjectResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/projects/{id}": {
			"get": {
				"tags": ["Projects"],
				"summary": "Get a project",
				"description": "Returns a single project by ID.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Project ID"
						},
						"required": true,
						"description": "Project ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Project details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProjectResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"put": {
				"tags": ["Projects"],
				"summary": "Update a project",
				"description": "Updates an existing project. Only provided fields are updated; fields outside the request schema are ignored.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Project ID"
						},
						"required": true,
						"description": "Project ID",
						"name": "id",
						"in": "path"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateProjectRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Project updated successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProjectResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": ["Projects"],
				"summary": "Delete a project",
				"description": "Archives a project (soft delete). The project can be restored later.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Project ID"
						},
						"required": true,
						"description": "Project ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"204": {
						"description": "Project deleted successfully"
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/project-templates": {
			"get": {
				"tags": ["Projects"],
				"summary": "List project templates",
				"description": "Returns the project templates a new project can be created from (the `templateId` of `POST /api/v1/projects`): the account’s active templates and the system templates enabled for the account.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"responses": {
					"200": {
						"description": "List of project templates",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProjectTemplatesListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/contacts": {
			"get": {
				"tags": ["Contacts"],
				"summary": "List contacts",
				"description": "Returns a paginated list of contacts for the authenticated account. Supports filtering by contact type (private/business) and archived status.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["private", "business"],
							"example": "private",
							"description": "Filter by contact type"
						},
						"required": false,
						"description": "Filter by contact type",
						"name": "kind",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["true", "false"],
							"example": "false",
							"description": "Include archived contacts (default: false)"
						},
						"required": false,
						"description": "Include archived contacts (default: false)",
						"name": "archived",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of contacts",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactsListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"post": {
				"tags": ["Contacts"],
				"summary": "Create a contact",
				"description": "Creates a new contact in the authenticated account. Must specify kind (\"private\" or \"business\") and include the corresponding data object. The contact and its private/business details are written atomically: a failed create leaves nothing behind. An email address already held by an active contact is refused with 409 unless allowDuplicateEmail is true. Send an Idempotency-Key header to make retries safe: a repeated key returns the contact the first request created (200) instead of creating another.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"description": "Opt-in retry key. A request repeating a key whose create already committed returns that contact with 200 and creates nothing.",
							"example": "b3f1c2d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
						},
						"required": false,
						"description": "Opt-in retry key. A request repeating a key whose create already committed returns that contact with 200 and creates nothing.",
						"name": "Idempotency-Key",
						"in": "header"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateContactRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Idempotent replay: the contact an earlier request with the same Idempotency-Key created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactResponse"
								}
							}
						}
					},
					"201": {
						"description": "Contact created successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactResponse"
								}
							}
						}
					},
					"400": {
						"description": "Invalid request (validation_error: missing kind or name, or a business contact given a parentContactId; bad_request: the contact could not be written)",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict: the email address is already used by an active contact (set allowDuplicateEmail to confirm), or the Idempotency-Key has no committed contact",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/contacts/{id}": {
			"get": {
				"tags": ["Contacts"],
				"summary": "Get a contact",
				"description": "Returns a single contact by ID.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Contact ID"
						},
						"required": true,
						"description": "Contact ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Contact details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"put": {
				"tags": ["Contacts"],
				"summary": "Update a contact",
				"description": "Updates an existing contact. Only provided fields will be updated. Include either private or business data object based on contact type.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Contact ID"
						},
						"required": true,
						"description": "Contact ID",
						"name": "id",
						"in": "path"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateContactRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Contact updated successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ContactResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": ["Contacts"],
				"summary": "Archive a contact",
				"description": "Archives a contact (soft delete). The contact can be restored later.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Contact ID"
						},
						"required": true,
						"description": "Contact ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"204": {
						"description": "Contact archived successfully"
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/tasks": {
			"get": {
				"tags": ["Tasks"],
				"summary": "List tasks",
				"description": "Returns a paginated list of tasks for the authenticated account. Supports filtering by status, project, and assignee.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["de", "en", "fr", "it"],
							"description": "Language for `displayTitle` (default: the caller’s language, else de)"
						},
						"required": false,
						"description": "Language for `displayTitle` (default: the caller’s language, else de)",
						"name": "locale",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"example": "open,workInProgress",
							"description": "Filter by status system key, comma-separated (open, workInProgress, waitingForExternalFeedback, waitingForInternalFeedback, waitingForCustomerFeedback, dateSet, ordered, completed)"
						},
						"required": false,
						"description": "Filter by status system key, comma-separated (open, workInProgress, waitingForExternalFeedback, waitingForInternalFeedback, waitingForCustomerFeedback, dateSet, ordered, completed)",
						"name": "status",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Filter by project ID"
						},
						"required": false,
						"description": "Filter by project ID",
						"name": "projectId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Filter by assignee ID"
						},
						"required": false,
						"description": "Filter by assignee ID",
						"name": "assigneeId",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of tasks",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TasksListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/tasks/{id}": {
			"get": {
				"tags": ["Tasks"],
				"summary": "Get a task",
				"description": "Returns a single task by ID, including project reference.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Task ID"
						},
						"required": true,
						"description": "Task ID",
						"name": "id",
						"in": "path"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["de", "en", "fr", "it"],
							"description": "Language for `displayTitle` (default: the caller’s language, else de)"
						},
						"required": false,
						"description": "Language for `displayTitle` (default: the caller’s language, else de)",
						"name": "locale",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "Task details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TaskResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"put": {
				"tags": ["Tasks"],
				"summary": "Update a task",
				"description": "Updates an existing task. Only provided fields will be updated. The deprecated checklistItems field is ignored; when it is sent, the X-Checklist-Update header is still set in the response.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Task ID"
						},
						"required": true,
						"description": "Task ID",
						"name": "id",
						"in": "path"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["de", "en", "fr", "it"],
							"description": "Language for `displayTitle` (default: the caller’s language, else de)"
						},
						"required": false,
						"description": "Language for `displayTitle` (default: the caller’s language, else de)",
						"name": "locale",
						"in": "query"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateTaskRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Task updated successfully",
						"headers": {
							"X-Checklist-Update": {
								"description": "Set to \"true\" when checklist items were modified",
								"schema": {
									"type": "string",
									"example": "true"
								}
							}
						},
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TaskResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": ["Tasks"],
				"summary": "Delete a task",
				"description": "Deletes a task. By default, performs a permanent delete. Use ?soft=true to soft delete (disable) the task instead.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Task ID"
						},
						"required": true,
						"description": "Task ID",
						"name": "id",
						"in": "path"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["true", "false"],
							"example": "true",
							"description": "If true, soft delete (disable) instead of permanent delete"
						},
						"required": false,
						"description": "If true, soft delete (disable) instead of permanent delete",
						"name": "soft",
						"in": "query"
					}
				],
				"responses": {
					"204": {
						"description": "Task deleted successfully"
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/team-members": {
			"get": {
				"tags": ["Team Members"],
				"summary": "List team members",
				"description": "Returns a paginated list of team members for the authenticated account. Supports filtering by archived status.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["true", "false", "only"],
							"example": "false",
							"description": "Include archived team members: 'true' (include), 'false' (exclude, default), 'only' (only archived)"
						},
						"required": false,
						"description": "Include archived team members: 'true' (include), 'false' (exclude, default), 'only' (only archived)",
						"name": "archived",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of team members",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TeamMembersListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/team-members/invitations": {
			"post": {
				"tags": ["Team Members"],
				"summary": "Invite a team member",
				"description": "Invites someone to the account by email, exactly like Settings → Users: the invitee receives an invitation email and becomes a team member, with the chosen role and access profile, when they accept. Requires an owner or admin; only an owner can invite an owner. Returns 409 when the email is already a member, has a pending invitation, or belongs to an archived member. Replaces the former POST /api/v1/team-members, which added an existing user directly.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/InviteTeamMemberRequest"
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Invitation created and invitation email queued",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TeamMemberInvitationResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/team-members/{id}": {
			"get": {
				"tags": ["Team Members"],
				"summary": "Get a team member",
				"description": "Returns a single team member by ID.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Team Member ID"
						},
						"required": true,
						"description": "Team Member ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Team member details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TeamMemberResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"put": {
				"tags": ["Team Members"],
				"summary": "Update a team member",
				"description": "Updates an existing team member. Only provided fields will be updated.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Team Member ID"
						},
						"required": true,
						"description": "Team Member ID",
						"name": "id",
						"in": "path"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateTeamMemberRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Team member updated successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TeamMemberResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": ["Team Members"],
				"summary": "Archive a team member",
				"description": "Archives a team member (soft delete). The team member can be restored later.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Team Member ID"
						},
						"required": true,
						"description": "Team Member ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"204": {
						"description": "Team member archived successfully"
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/files": {
			"get": {
				"tags": ["Files"],
				"summary": "List files",
				"description": "Returns a paginated list of files for the authenticated account. Supports filtering by project ID and file type.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Filter by project ID"
						},
						"required": false,
						"description": "Filter by project ID",
						"name": "projectId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"example": "application/pdf",
							"description": "Filter by MIME type"
						},
						"required": false,
						"description": "Filter by MIME type",
						"name": "type",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of files",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FilesListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"post": {
				"tags": ["Files"],
				"summary": "Register a stored object as a file",
				"description": "Registers an object that already exists in the account bucket as a file. The request is rejected when no object is stored at `storagePath`, when `storagePath` is not a primary object under `uploads/`, when another file already owns it, when `type` or `size` do not match the stored object, or when `category` is not a category of the account. To upload a new file, use POST /api/v1/files/uploads.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateFileRequest"
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "File record created successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FileResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": ["Files"],
				"summary": "Bulk delete files",
				"description": "Permanently deletes multiple files by their IDs. This also removes the files from storage.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/BulkDeleteFilesRequest"
							}
						}
					}
				},
				"responses": {
					"204": {
						"description": "Files deleted successfully"
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/files/{id}": {
			"get": {
				"tags": ["Files"],
				"summary": "Get a file",
				"description": "Returns a single file record by ID.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "File ID"
						},
						"required": true,
						"description": "File ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "File details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FileResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"put": {
				"tags": ["Files"],
				"summary": "Update a file",
				"description": "Updates an existing file record. Only provided fields will be updated.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "File ID"
						},
						"required": true,
						"description": "File ID",
						"name": "id",
						"in": "path"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateFileRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "File updated successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FileResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": ["Files"],
				"summary": "Delete a file",
				"description": "Permanently deletes a file by ID. This also removes the file from storage.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "File ID"
						},
						"required": true,
						"description": "File ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"204": {
						"description": "File deleted successfully"
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/files/{id}/download-url": {
			"get": {
				"tags": ["Files"],
				"summary": "Get a download URL",
				"description": "Returns a short-lived (5 minutes) signed URL for the file contents. Fetch the bytes right away and request a new URL next time. Requires the `files:read` scope for API keys.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "File ID"
						},
						"required": true,
						"description": "File ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Signed download URL",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FileDownloadUrlResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/files/categories": {
			"get": {
				"tags": ["Files"],
				"summary": "List file categories",
				"description": "The file categories of the account: its own categories and the built-in ones it has not hidden. A file's `category` must be one of these ids.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"responses": {
					"200": {
						"description": "File categories",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FileCategoriesResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/files/uploads": {
			"post": {
				"tags": ["Files"],
				"summary": "Start a file upload",
				"description": "Reserves a file and returns a signed URL (valid 2 hours) to upload its bytes to. Upload in three steps: (1) call this endpoint, (2) PUT the raw bytes to `uploadUrl` with the returned `headers`, (3) call POST /api/v1/files/uploads/{id}/complete. The file stays invisible until it is completed; an upload that is never completed is removed after 48 hours. The server chooses the storage location.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateFileUploadRequest"
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Upload reserved",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FileUploadResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/files/uploads/{id}/complete": {
			"post": {
				"tags": ["Files"],
				"summary": "Complete a file upload",
				"description": "Publishes an uploaded file. Checks that the bytes were uploaded with the declared size and the returned Content-Type header, removes location (GPS/EXIF) metadata from JPEG images (recognised by their content, whatever type was declared), and makes the file visible in the app. Returns 409 when nothing was uploaded yet or another completion of the same upload is still running, and 422 when the upload does not match. Calling it again for a completed upload returns the file.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "The `fileId` from POST /api/v1/files/uploads"
						},
						"required": true,
						"description": "The `fileId` from POST /api/v1/files/uploads",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "File published",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/FileResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/comments": {
			"get": {
				"tags": ["Comments"],
				"summary": "List comments",
				"description": "Returns the comments of one parent resource — a project, task, lead or contact — newest first, paginated. At least one parent filter is required (400 otherwise). Access follows the parent: a caller who can see the project, lead or contact can read its comments; no separate Issues permission is needed (except for a personal task with no project, lead or contact, which stays an Issues resource).",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Comments of this project. At least one of projectId, taskId, leadId or contactId is required."
						},
						"required": false,
						"description": "Comments of this project. At least one of projectId, taskId, leadId or contactId is required.",
						"name": "projectId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Comments of this task"
						},
						"required": false,
						"description": "Comments of this task",
						"name": "taskId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Comments of this lead"
						},
						"required": false,
						"description": "Comments of this lead",
						"name": "leadId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Comments of this contact"
						},
						"required": false,
						"description": "Comments of this contact",
						"name": "contactId",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of comments",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CommentsListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"post": {
				"tags": ["Comments"],
				"summary": "Create a comment",
				"description": "Creates a comment on a project, task, lead or contact and notifies the mentioned users (assigneeIds). Requires content and at least one of projectId, taskId, leadId or contactId. Access follows the parent; no separate Issues permission is needed.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateCommentRequest"
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Comment created successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CommentResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/comments/{id}": {
			"get": {
				"tags": ["Comments"],
				"summary": "Get a comment",
				"description": "Returns a single comment by ID.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Comment ID"
						},
						"required": true,
						"description": "Comment ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Comment details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CommentResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"put": {
				"tags": ["Comments"],
				"summary": "Update a comment",
				"description": "Updates an existing comment. Only provided fields will be updated.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Comment ID"
						},
						"required": true,
						"description": "Comment ID",
						"name": "id",
						"in": "path"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateCommentRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Comment updated successfully",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CommentResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": ["Comments"],
				"summary": "Delete a comment",
				"description": "Permanently deletes a comment by ID.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Comment ID"
						},
						"required": true,
						"description": "Comment ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"204": {
						"description": "Comment deleted successfully"
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/notes": {
			"get": {
				"tags": ["Notes"],
				"summary": "List notes",
				"description": "Returns the notes of one project, task or project stage, newest first, paginated; the app shows the newest. One of projectId or taskId is required, and a UUID (400 otherwise); a stage is a task, so its notes are read with taskId. With projectId, includeStages=true adds the notes of the project’s stages. Access follows the parent, exactly as in the app: a caller who can open the project or task can read its notes. Notes embed files by reference; see `attachments`. Read-only: notes are written in the app. Notes whose parent is a lead or contact itself are not part of the API; notes on a task in a lead or contact context are read with taskId, gated by the leads / contacts permission.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Notes of this project. One of projectId or taskId is required."
						},
						"required": false,
						"description": "Notes of this project. One of projectId or taskId is required.",
						"name": "projectId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["true", "false"],
							"description": "With projectId: `true` also returns the notes of the project’s stages (default: `false`)"
						},
						"required": false,
						"description": "With projectId: `true` also returns the notes of the project’s stages (default: `false`)",
						"name": "includeStages",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Notes of this task or project stage (a stage is a task). Takes precedence over projectId."
						},
						"required": false,
						"description": "Notes of this task or project stage (a stage is a task). Takes precedence over projectId.",
						"name": "taskId",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of notes",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotesListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/notes/{id}": {
			"get": {
				"tags": ["Notes"],
				"summary": "Get a note",
				"description": "Returns a single project, task or stage note by ID, with its attached file references.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Note ID"
						},
						"required": true,
						"description": "Note ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Note details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NoteResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/search": {
			"get": {
				"tags": ["Search"],
				"summary": "Search resources",
				"description": "Performs a unified search across projects, contacts, files and leads for the authenticated account. Returns at most the first 100 matches; results the caller may not open are left out.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"minLength": 1,
							"example": "Müller solar",
							"description": "Search query (required). Searches across projects, contacts, files and leads."
						},
						"required": true,
						"description": "Search query (required). Searches across projects, contacts, files and leads.",
						"name": "q",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["project", "contact", "file", "lead"],
							"example": "project",
							"description": "Filter results by resource type"
						},
						"required": false,
						"description": "Filter results by resource type",
						"name": "type",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "Search results",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/SearchResultsResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/schedule-events": {
			"get": {
				"tags": ["Schedule"],
				"summary": "List schedule events",
				"description": "Returns the resource planner events that overlap the requested range: project work, absences and other events, with their assignments and linked project. Read-only; requires resource-planning access (API key scope `planner:read`).",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"example": "2026-11-10",
							"description": "Range start (ISO 8601 date or date-time). Events ending after it are included."
						},
						"required": true,
						"description": "Range start (ISO 8601 date or date-time). Events ending after it are included.",
						"name": "from",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"example": "2026-11-17",
							"description": "Range end (ISO 8601 date or date-time), after `from`. Events starting before it are included."
						},
						"required": true,
						"description": "Range end (ISO 8601 date or date-time), after `from`. Events starting before it are included.",
						"name": "to",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"example": "Absence",
							"description": "Filter by category"
						},
						"required": false,
						"description": "Filter by category",
						"name": "category",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Only events assigned to this user (user or team-member id)"
						},
						"required": false,
						"description": "Only events assigned to this user (user or team-member id)",
						"name": "userId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Only events linked to this project"
						},
						"required": false,
						"description": "Only events linked to this project",
						"name": "projectId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["true", "false"],
							"description": "Include archived events and the events of archived projects. Default `false`: the events of an archived project are left out, as in the planner."
						},
						"required": false,
						"description": "Include archived events and the events of archived projects. Default `false`: the events of an archived project are left out, as in the planner.",
						"name": "includeArchived",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["de", "en", "fr", "it"],
							"description": "Language for `displayTitle` category labels and linked stage/task names (default: the caller’s language, else de)"
						},
						"required": false,
						"description": "Language for `displayTitle` category labels and linked stage/task names (default: the caller’s language, else de)",
						"name": "locale",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "Schedule events in the range",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ScheduleEventsResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/leads": {
			"get": {
				"tags": ["Leads"],
				"summary": "List leads",
				"description": "Returns a paginated list of leads, newest first, with their customer and object address. Archived leads are excluded unless `archived` says otherwise.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["active", "won", "lost", "archived"],
							"example": "active",
							"description": "Filter by status"
						},
						"required": false,
						"description": "Filter by status",
						"name": "status",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Filter by pipeline column"
						},
						"required": false,
						"description": "Filter by pipeline column",
						"name": "columnId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Filter by assigned team member"
						},
						"required": false,
						"description": "Filter by assigned team member",
						"name": "assigneeId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"enum": ["true", "false", "only"],
							"example": "false",
							"description": "Archived filter: false (default, exclude archived), true (include), only (archived only)"
						},
						"required": false,
						"description": "Archived filter: false (default, exclude archived), true (include), only (archived only)",
						"name": "archived",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"maxLength": 200,
							"example": "Müller",
							"description": "Case-insensitive match on title, lead number and internal reference"
						},
						"required": false,
						"description": "Case-insensitive match on title, lead number and internal reference",
						"name": "search",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of leads",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadsListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"post": {
				"tags": ["Leads"],
				"summary": "Create a lead",
				"description": "Creates a lead the same way the app does: with a customer contact and an object address, in the first active pipeline column unless `columnId` says otherwise. A title an active lead already holds is refused with 409. Fields outside the request schema are ignored.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateLeadRequest"
							}
						}
					}
				},
				"responses": {
					"201": {
						"description": "Lead created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/leads/{id}": {
			"get": {
				"tags": ["Leads"],
				"summary": "Get a lead",
				"description": "Returns a single lead by ID.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Lead ID"
						},
						"required": true,
						"description": "Lead ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Lead details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			},
			"put": {
				"tags": ["Leads"],
				"summary": "Update a lead",
				"description": "Updates a lead. Only provided fields change; `status` and `columnId` move the lead through the pipeline like the app’s lead board. Renaming a lead onto a title another active lead already holds is refused with 409 and nothing changes (sending the lead’s own current title is fine). Fields outside the request schema are ignored.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Lead ID"
						},
						"required": true,
						"description": "Lead ID",
						"name": "id",
						"in": "path"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateLeadRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Lead updated",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"409": {
						"description": "Conflict: the new title is already held by another active lead, or the lead cannot make the requested move in its current state",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/lead-columns": {
			"get": {
				"tags": ["Leads"],
				"summary": "List lead pipeline columns",
				"description": "Returns the account’s active lead pipeline columns in board order — the `columnId` values leads accept.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"responses": {
					"200": {
						"description": "Lead pipeline columns",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LeadColumnsResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/offers": {
			"get": {
				"tags": ["Offers"],
				"summary": "List offers",
				"description": "Returns the offers of one lead or project (archived offers excluded), newest first, paginated. One of leadId or projectId is required. Each offer lists its variants with their line items, discount and totals: every variant while the offer is open (alternatives — never add them up), only the accepted variant once it is accepted. A lead or project may have several accepted offers (e.g. PV and, later, a wallbox). Requires the offers permission and access to the lead or project. Read-only: offers are written in the app.",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"default": 1,
							"example": 1,
							"description": "Page number (1-indexed)"
						},
						"required": false,
						"description": "Page number (1-indexed)",
						"name": "page",
						"in": "query"
					},
					{
						"schema": {
							"type": "number",
							"minimum": 1,
							"maximum": 100,
							"default": 20,
							"example": 20,
							"description": "Number of items per page (max 100)"
						},
						"required": false,
						"description": "Number of items per page (max 100)",
						"name": "pageSize",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Offers of this lead. One of leadId or projectId is required."
						},
						"required": false,
						"description": "Offers of this lead. One of leadId or projectId is required.",
						"name": "leadId",
						"in": "query"
					},
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Offers of this project. One of leadId or projectId is required."
						},
						"required": false,
						"description": "Offers of this project. One of leadId or projectId is required.",
						"name": "projectId",
						"in": "query"
					}
				],
				"responses": {
					"200": {
						"description": "List of offers",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/OffersListResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		},
		"/api/v1/offers/{id}": {
			"get": {
				"tags": ["Offers"],
				"summary": "Get an offer",
				"description": "Returns a single offer with its variants, line items, discounts and totals (see List offers for how variants read before and after acceptance).",
				"security": [
					{
						"BearerAuth": []
					},
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Offer ID"
						},
						"required": true,
						"description": "Offer ID",
						"name": "id",
						"in": "path"
					}
				],
				"responses": {
					"200": {
						"description": "Offer details",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/OfferResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized - Authentication required",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UnauthorizedError"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden - Insufficient permissions",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ForbiddenError"
								}
							}
						}
					},
					"404": {
						"description": "Not Found - Resource does not exist",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/NotFoundError"
								}
							}
						}
					},
					"422": {
						"description": "Validation Error - Invalid request data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ValidationError"
								}
							}
						}
					}
				}
			}
		}
	},
	"webhooks": {
		"lead.created": {
			"post": {
				"tags": ["Webhooks"],
				"summary": "Lead created",
				"description": "A lead was created, by hand, by import or through the API.",
				"security": [],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Event ID, identical on every attempt"
						},
						"required": true,
						"description": "Event ID, identical on every attempt",
						"name": "webhook-id",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "1795513810",
							"description": "When this attempt was made (Unix seconds)"
						},
						"required": true,
						"description": "When this attempt was made (Unix seconds)",
						"name": "webhook-timestamp",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=",
							"description": "Signature over the event ID, the timestamp and the raw body"
						},
						"required": true,
						"description": "Signature over the event ID, the timestamp and the raw body",
						"name": "webhook-signature",
						"in": "header"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/LeadCreatedEvent"
							}
						}
					}
				},
				"responses": {
					"2XX": {
						"description": "Received. Any other answer is retried."
					}
				}
			}
		},
		"lead.status_changed": {
			"post": {
				"tags": ["Webhooks"],
				"summary": "Lead status changed",
				"description": "A lead moved to another pipeline column, or was won, lost, archived or reopened.",
				"security": [],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Event ID, identical on every attempt"
						},
						"required": true,
						"description": "Event ID, identical on every attempt",
						"name": "webhook-id",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "1795513810",
							"description": "When this attempt was made (Unix seconds)"
						},
						"required": true,
						"description": "When this attempt was made (Unix seconds)",
						"name": "webhook-timestamp",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=",
							"description": "Signature over the event ID, the timestamp and the raw body"
						},
						"required": true,
						"description": "Signature over the event ID, the timestamp and the raw body",
						"name": "webhook-signature",
						"in": "header"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/LeadStatusChangedEvent"
							}
						}
					}
				},
				"responses": {
					"2XX": {
						"description": "Received. Any other answer is retried."
					}
				}
			}
		},
		"project.created": {
			"post": {
				"tags": ["Webhooks"],
				"summary": "Project created",
				"description": "A project was created.",
				"security": [],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Event ID, identical on every attempt"
						},
						"required": true,
						"description": "Event ID, identical on every attempt",
						"name": "webhook-id",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "1795513810",
							"description": "When this attempt was made (Unix seconds)"
						},
						"required": true,
						"description": "When this attempt was made (Unix seconds)",
						"name": "webhook-timestamp",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=",
							"description": "Signature over the event ID, the timestamp and the raw body"
						},
						"required": true,
						"description": "Signature over the event ID, the timestamp and the raw body",
						"name": "webhook-signature",
						"in": "header"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/ProjectCreatedEvent"
							}
						}
					}
				},
				"responses": {
					"2XX": {
						"description": "Received. Any other answer is retried."
					}
				}
			}
		},
		"project.completed": {
			"post": {
				"tags": ["Webhooks"],
				"summary": "Project completed",
				"description": "A project was completed.",
				"security": [],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Event ID, identical on every attempt"
						},
						"required": true,
						"description": "Event ID, identical on every attempt",
						"name": "webhook-id",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "1795513810",
							"description": "When this attempt was made (Unix seconds)"
						},
						"required": true,
						"description": "When this attempt was made (Unix seconds)",
						"name": "webhook-timestamp",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=",
							"description": "Signature over the event ID, the timestamp and the raw body"
						},
						"required": true,
						"description": "Signature over the event ID, the timestamp and the raw body",
						"name": "webhook-signature",
						"in": "header"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/ProjectCompletedEvent"
							}
						}
					}
				},
				"responses": {
					"2XX": {
						"description": "Received. Any other answer is retried."
					}
				}
			}
		},
		"offer.accepted": {
			"post": {
				"tags": ["Webhooks"],
				"summary": "Offer accepted",
				"description": "An offer was accepted. `offer.variants` holds only the accepted variant, with the line items, discounts and totals the customer accepted.",
				"security": [],
				"parameters": [
					{
						"schema": {
							"type": "string",
							"format": "uuid",
							"example": "550e8400-e29b-41d4-a716-446655440000",
							"description": "Event ID, identical on every attempt"
						},
						"required": true,
						"description": "Event ID, identical on every attempt",
						"name": "webhook-id",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "1795513810",
							"description": "When this attempt was made (Unix seconds)"
						},
						"required": true,
						"description": "When this attempt was made (Unix seconds)",
						"name": "webhook-timestamp",
						"in": "header"
					},
					{
						"schema": {
							"type": "string",
							"example": "v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=",
							"description": "Signature over the event ID, the timestamp and the raw body"
						},
						"required": true,
						"description": "Signature over the event ID, the timestamp and the raw body",
						"name": "webhook-signature",
						"in": "header"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/OfferAcceptedEvent"
							}
						}
					}
				},
				"responses": {
					"2XX": {
						"description": "Received. Any other answer is retried."
					}
				}
			}
		}
	}
}
