{"openapi":"3.1.0","info":{"version":"1.0.0","title":"Texture API","description":"# Texture REST API\n\nWelcome to the Texture REST API documentation. Texture provides a comprehensive platform for managing energy devices, sites, and customer data at scale.\n\n## Getting Started\n\n### 1. Create an Account\nVisit [app.texturehq.com](https://app.texturehq.com) to create your Texture account and access your API credentials.\n\n### 2. Obtain Your API Key\nOnce logged in to the dashboard:\n- Navigate to Developer → API Keys\n- Create a new API key with appropriate permissions\n- You can create multiple keys for different purposes or scopes so we suggest creating a different key for each purpose or scope.\n\n### 3. Authentication\n\n#### API Keys\nInclude your API key in the request header:\n```\nTexture-Api-Key: your-api-key-here\n```\n\n**Server API Keys** provide full access to all API endpoints for your workspace. These should be kept secret and only used in backend services.\n\n#### Scoped Keys\n**Scoped keys** are obtained through the [Texture Connect](https://docs.texturehq.com/integrations/texture-connect) flow and provide limited, user-specific access. They use the same authentication header:\n```\nTexture-Api-Key: scoped_abc123...\n```\n\nScoped keys are prefixed with `scoped_` and are automatically restricted to:\n- **Device read operations** - View device data, history, alerts, tags, and schedules\n- **Commands** - Send commands to devices (the only write operation supported)\n- **User's connected devices only** - Automatically filtered by referenceId\n\nScoped keys are ideal for frontend applications and mobile apps where you need secure, user-specific API access without exposing your server API key.\n\nFor complete documentation on scoped keys, see our [Scoped Keys Guide](https://docs.texturehq.com/api/scoped-keys).\n\n### 4. Make Your First Request\nTry fetching your devices:\n```bash\ncurl -H \"Texture-Api-Key: your-api-key-here\"   https://api.texturehq.com/v1/devices\n```\n\n## Core Capabilities\n\nThe Texture API enables you to:\n\n- **Device Management**: Register, monitor, and control energy devices including batteries, solar panels, and EV chargers\n- **Site Management**: Organize devices by physical locations and manage site configurations\n- **Customer Management**: Track customer information and device ownership\n- **Energy Metrics**: Access real-time and historical energy data\n- **Commands & Control**: Send commands to devices for optimization and control\n- **Alerts & Monitoring**: Configure and manage alerts for device events\n- **Programs & Schedules**: Create and manage energy programs and schedules\n- **Enrollments**: Manage device enrollments in utility, demand response, and other programs\n\n## API Design Principles\n\n- **RESTful**: Standard HTTP methods (GET, POST, PUT, DELETE)\n- **JSON**: All requests and responses use JSON format\n- **Pagination**: List endpoints support pagination\n- **Consistent Error Handling**: Standardized error responses across all endpoints\n- **Idempotency**: Safe retry mechanisms for critical operations\n\n## Rate Limits\n\nAPI requests are rate-limited to ensure platform stability:\n- **Standard**: 1,000 requests per minute\n- **Bulk Operations**: 100 requests per minute\n- Contact support for higher limits\n\n## SDKs & Client Libraries\n\nGenerate client libraries using our OpenAPI specification:\n- **Download OpenAPI Spec**: [https://api.texturehq.com/v1/docs/swagger.json](https://api.texturehq.com/v1/docs/swagger.json)\n- **TypeScript/JavaScript**: Use openapi-generator or similar tools\n- **Python**: Generate with openapi-python-client\n- **Other Languages**: Any OpenAPI 3.1 compatible generator\n\n## Support & Resources\n\n- **Documentation**: [docs.texturehq.com](https://docs.texturehq.com)\n- **API Status**: [status.texturehq.com](https://status.texturehq.com)\n- **Support**: [support@texturehq.com](mailto:support@texturehq.com)\n- **Slack Community**: [Join our Slack](https://join.slack.com/t/texture-community/shared_invite/zt-2ho02ds2o-pBNH1ZGcopxgIY3BgKcKzg)\n\n---\n\n**Note**: This API is actively maintained and expanded. We follow semantic versioning and provide migration guides for breaking changes.","contact":{"name":"Texture Support","email":"support@texturehq.com","url":"https://www.texturehq.com/contact"}},"servers":[{"url":"https://api.texturehq.com/v1"}],"security":[{"ApiKeyAuth":[]}],"externalDocs":{"description":"Find more documentation and guides","url":"https://docs.texturehq.com"},"tags":[{"name":"Devices","description":"Manage energy devices including batteries, solar panels, and EV chargers"},{"name":"Sites","description":"Organize devices by physical locations"},{"name":"Customers","description":"Customer information and device ownership"},{"name":"Metrics","description":"Real-time and historical energy data"},{"name":"Commands","description":"Device control and optimization"},{"name":"Alerts","description":"Alert configuration and management"},{"name":"Programs","description":"Energy program management"},{"name":"Schedules","description":"Schedule configuration for devices"},{"name":"Enrollments","description":"Device enrollment in utility programs"},{"name":"Connections","description":"Initiate link sessions and manage device connections"},{"name":"Leads","description":"Capture and manage potential customer leads"},{"name":"Manufacturers","description":"Details about supported device manufacturers"},{"name":"Organizations","description":"Information about your organization"},{"name":"Program Instances","description":"Manage individual instances of energy programs"},{"name":"OEM Direct Integration","description":"Endpoints for OEM manufacturers and Third-Party Device Operators (TPDOs) to provision devices and push telemetry directly to Texture. These endpoints require a MANUFACTURER API key and are NOT for standard OAuth-based device integrations. If you're connecting consumer devices like Ecobee or Tesla, use the Connections API with OAuth instead."}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Texture-Api-Key"}},"schemas":{"Address":{"type":"object","properties":{"streetOne":{"type":"string","minLength":1,"description":"The first line of the street address.","example":"123 Main St"},"streetTwo":{"type":"string","description":"The second line of the street address.","example":"Apt 4B"},"city":{"type":"string","minLength":1,"description":"The city of the address.","example":"New York"},"state":{"type":"string","minLength":1,"description":"The state of the address.","example":"NY"},"postalCode":{"type":"string","minLength":1,"description":"The postal code of the address.","example":"10001"},"country":{"type":"string","minLength":1,"default":"USA","description":"The country of the address.","example":"USA"}},"required":["streetOne","city","state","postalCode"]},"Alert":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the alert issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"externalId":{"type":["string","null"],"description":"The external identifier for the alert from the source system.","example":"alert-123456"},"sourceSystem":{"type":"string","description":"The source system that generated the alert.","example":"texture"},"alertType":{"type":["string","null"],"description":"Legacy free-text alert type.","example":"device_offline"},"type":{"type":"string","enum":["COMMUNICATIONS","POWER_LIMIT","GRID_STATUS","HARDWARE_FAULT","FIRMWARE_UPDATE","CONFIGURATION","VOLTAGE_FREQUENCY","STATE_OF_ENERGY","TEMPERATURE","ISLANDING","GENERATOR","SOFTWARE_PROCESS","SENSOR","SYSTEM_SHUTDOWN","PERFORMANCE_DEGRADED","SITE_LEVEL","SAFETY","UNKNOWN"],"description":"The normalized alert type.","example":"HARDWARE_FAULT","deprecated":false},"subtype":{"type":["string","null"],"enum":["BATTERY_METER_COMMS","INVERTER_COMMS","PV_INVERTER_COMMS","SITE_CONTROLLER_COMMS","SITE_MAX_LIMITED","SITE_MIN_LIMITED","RAMP_RATE_LIMITED","POWER_FACTOR_LIMITED","GRID_FORMING","GRID_FOLLOWING","GRID_RESYNC_FAILED","INVERTER_FAULT","BATTERY_FAULT","CONTACTOR_FAULT","GENERATOR_FAULT","OPTICASTER_EXE_FAILED","CONTROL_AGENT_CRASHED","LOW_SOE","SLEEP_MODE","WAIT_FOR_SOLAR","EXTERNAL_SWITCH_SHUTDOWN","GPIO_SHUTDOWN","EXCESSIVE_VOLTAGE_DROP","FREQUENCY_DEVIATION","METER_DISCONNECTED","TEMPERATURE_SENSOR_FAULT","PERFORMANCE_BELOW_EXPECTATION",null],"description":"Optional normalized subtype for the alert.","example":"BATTERY_METER_COMMS"},"providerCode":{"type":["string","null"],"description":"Provider-provided code or identifier, if any.","example":"3019"},"providerName":{"type":["string","null"],"description":"Provider display name for the alert.","example":"Battery Meter Comms"},"severity":{"type":"string","enum":["CRITICAL","WARNING","INFO"],"description":"The severity level of the alert.","example":"WARNING"},"status":{"type":"string","enum":["OPEN","ACKNOWLEDGED","IGNORED","RESOLVED"],"description":"The current status of the alert.","example":"OPEN"},"title":{"type":"string","description":"The title of the alert.","example":"Device is offline"},"description":{"type":["string","null"],"description":"Additional description or details about the alert.","example":"The thermostat in the bedroom has been offline for 15 minutes."},"deviceId":{"type":["string","null"],"description":"The unique identifier of the device this alert is related to.","example":"cllgn0u4r000008l7eazybfbo"},"siteId":{"type":["string","null"],"description":"The unique identifier of the site this alert is related to.","example":"cllgn0u4r000008l7eazybfbo"},"workspaceId":{"type":"string","description":"The workspace this alert belongs to.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":["string","null"],"format":"date-time","description":"The date and time the alert was created.","example":"2024-04-01T00:00:00.000Z"},"updatedAt":{"type":["string","null"],"format":"date-time","description":"The date and time the alert was last updated.","example":"2024-04-01T00:00:00.000Z"},"acknowledgedAt":{"type":["string","null"],"format":"date-time","description":"The date and time the alert was acknowledged.","example":"2024-04-01T00:00:00.000Z"},"ignoredAt":{"type":["string","null"],"format":"date-time","description":"The date and time the alert was ignored.","example":"2024-04-01T00:00:00.000Z"},"resolvedAt":{"type":["string","null"],"format":"date-time","description":"The date and time the alert was resolved.","example":"2024-04-01T00:00:00.000Z"},"acknowledgedBy":{"type":["string","null"],"description":"The user who acknowledged the alert.","example":"cllgn0u4r000008l7eazybfbo"},"ignoredBy":{"type":["string","null"],"description":"The user who ignored the alert.","example":"cllgn0u4r000008l7eazybfbo"},"resolvedBy":{"type":["string","null"],"description":"The user who resolved the alert.","example":"cllgn0u4r000008l7eazybfbo"},"snoozedUntil":{"type":["string","null"],"format":"date-time","description":"The date and time until which the alert is snoozed.","example":"2024-04-01T01:00:00.000Z"},"manufacturer":{"type":["string","null"],"description":"The manufacturer of the device.","example":"Sierra Wireless"},"manufacturerDeviceId":{"type":["string","null"],"description":"The manufacturer device id.","example":"C7625_S59240_DA0"},"deviceName":{"type":["string","null"],"description":"The manufacturer device name.","example":"Cell Modem"},"deviceType":{"type":["string","null"],"description":"The manufacturer device type.","example":"Sierra Wireless Event Reporting"},"deviceModel":{"type":["string","null"],"description":"The manufacturer device model.","example":"C7625"},"deviceSerialNumber":{"type":["string","null"],"description":"The manufacturer device serial number.","example":"QR1024744301B118"}},"required":["id","sourceSystem","type","severity","status","title","workspaceId","createdAt","updatedAt"]},"Alerts":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Alert"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]},"Command":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the command issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"status":{"type":"string","enum":["pending","completed","scheduled","failed"],"description":"The current status of the command.","example":"pending"},"reason":{"type":"string","description":"The reason for the command status."},"type":{"type":"string","enum":["battery:set-reserve","battery:set-operating-mode","charger:set-operating-mode","thermostat:set-operating-mode","thermostat:set-fan-mode","thermostat:pause-schedule","thermostat:resume-schedule","vehicle:set-charge-limit","vehicle:set-operating-mode"],"description":"The unique slug representing the type of command.","example":"thermostat:set-operating-mode"},"issuedAt":{"type":"string","format":"date-time","description":"The date and time the command was issued."},"executedAt":{"type":"string","format":"date-time","description":"The date and time the command was executed."},"input":{"type":"object","properties":{},"additionalProperties":{},"description":"The input payload sent with the command. Includes necessary information for execution. Conforms to the schema provided on the command type.","example":{"operatingMode":"eco","heatTarget":70.5,"coolTarget":80.5}}},"required":["id","status","type","issuedAt","input"]},"CommandType":{"type":"object","properties":{"slug":{"type":"string","enum":["battery:set-reserve","battery:set-operating-mode","charger:set-operating-mode","thermostat:set-operating-mode","thermostat:set-fan-mode","thermostat:pause-schedule","thermostat:resume-schedule","vehicle:set-charge-limit","vehicle:set-operating-mode"],"description":"The unique slug representing the type of command.","example":"thermostat:set-operating-mode"},"description":{"type":"string","description":"A brief description of the command type.","example":"Sets the operating mode of the thermostat."}},"required":["slug","description"]},"CreateLinkSessionParams":{"type":"object","properties":{"referenceId":{"type":"string","maxLength":1000,"description":"The reference ID of the user associated with the link session. If not provided one will be generated for you.","example":"9bb290c8-fe97-46ce-92a8-952823164277"},"redirectUrl":{"type":"string","format":"uri","description":"The URL to redirect to after the link session is complete. Will contain texture_scoped_token as a query param.","example":"https://example.com/redirect"},"tags":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":100,"description":"The tags associated with the link session.","example":["tag1","tag2"]},"clientName":{"type":"string","maxLength":100,"description":"The name of the client associated with the link session.","example":"Texture"},"manufacturerFilters":{"type":"object","properties":{"manufacturers":{"type":"array","items":{"type":"string"},"minItems":1,"description":"The manufacturers you'd like to restrict choices to or pre-select in the case of 1 manufacturer specified for this link session.","example":["honeywell","daikin"]},"deviceTypes":{"type":"array","items":{"type":"string","enum":["battery","charger","inverter","meter","thermostat","vehicle","other","unknown"]},"minItems":1,"description":"The device types you'd like to restrict choices to (will filter out manufacturers that don't have any of the selected device types).","example":["thermostat"]}},"description":"The filters for the manufacturers associated with the link session."},"customerInfo":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"The email of the customer associated with the link session.","example":"example@example.com"},"phone":{"type":"string","minLength":5,"maxLength":20,"description":"The phone number of the customer associated with the link session.","example":"1234567890"},"firstName":{"type":"string","minLength":1,"maxLength":100,"description":"The first name of the customer associated with the link session.","example":"John"},"lastName":{"type":"string","minLength":1,"maxLength":100,"description":"The last name of the customer associated with the link session.","example":"Doe"},"location":{"type":"object","properties":{"streetOne":{"type":"string","minLength":1,"maxLength":100,"description":"The first line of the address of the location associated with the link session.","example":"123 Main St"},"streetTwo":{"type":"string","minLength":1,"maxLength":100,"description":"The second line of the address of the location associated with the link session.","example":"Unit 1"},"city":{"type":"string","minLength":1,"maxLength":100,"description":"The city of the location associated with the link session.","example":"Toronto"},"state":{"type":"string","minLength":1,"maxLength":100,"description":"The state of the location associated with the link session.","example":"Ontario"},"postalCode":{"type":"string","minLength":1,"maxLength":100,"description":"The postal code of the location associated with the link session.","example":"M5V 1A1"},"country":{"type":"string","minLength":1,"maxLength":100,"description":"The country of the location associated with the link session.","example":"Canada"}},"required":["streetOne","city","state","postalCode","country"],"description":"The location of the customer associated with the link session."}},"description":"The information about the customer associated with the link session."},"customerId":{"type":"string","format":"cuid","description":"The ID of a customer to associate with the link session.","example":"cllh2buhk000008la0ln6cb80"},"params":{}}},"CreateProgramInstanceBody":{"type":"object","properties":{"slug":{"type":"string","description":"The slug of the program instance","example":"nyc-battery-program-2025-coned"},"programSlug":{"type":"string","description":"The slug of the program to create an instance for","example":"nyc-battery-program-2025"},"title":{"type":"string","description":"The title of the program instance","example":"NYC Battery Program 2025 - ConEd"},"description":{"type":"string","description":"The description of the program instance","example":"This program is for homeowners in NYC that have installed battery storage systems."},"eligibilityCriteria":{"type":"string","description":"The eligibility criteria of the program instance","example":"Homeowners in NYC that have installed battery storage systems."},"programTerms":{"type":"string","description":"The terms of the program instance","example":"Homeowners in NYC that have installed battery storage systems."},"customFields":{"type":"object","additionalProperties":{},"description":"The custom fields of the program instance"}},"required":["slug","programSlug","title","description","eligibilityCriteria","programTerms"]},"Customer":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the customer issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"workspaceId":{"type":"string","format":"cuid","description":"The unique identifier for the workspace issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"referenceId":{"type":["string","null"],"description":"The reference ID for the customer.","example":"01234567"},"firstName":{"type":["string","null"],"description":"The given name of the customer.","example":"John"},"lastName":{"type":["string","null"],"description":"The surname of the customer.","example":"Smith"},"email":{"type":["string","null"],"format":"email","description":"The email address of the customer.","example":"test@example.com"},"phone":{"type":["string","null"],"description":"The phone number of the customer as provided during creation or update.","example":"1234567890"},"devices":{"type":"array","items":{"$ref":"#/components/schemas/Device"},"description":"The devices connected to the customer."},"createdAt":{"type":["string","null"],"format":"date-time","description":"The date and time the customer was created in the system.","example":"2026-03-12T21:15:16.073Z"},"updatedAt":{"type":["string","null"],"format":"date-time","description":"The date and time the customer was last updated in the system.","example":"2026-03-12T21:15:16.073Z"},"connectedSiteIds":{"type":"array","items":{"type":"string","format":"cuid"},"description":"The unique identifiers for the sites created for the customer by Texture.","example":["clmt0f0qq000g6jez6qa2sj4t","clmt0f0qq000g6jez6qa2sj4u"]},"connectedDeviceIds":{"type":"array","items":{"type":"string","format":"cuid"},"description":"The unique identifiers for the devices connected to the customer.","example":["clmt0f0qq000g6jez6qa2sj4t","clmt0f0qq000g6jez6qa2sj4u"]}},"required":["id","workspaceId","referenceId","createdAt","connectedSiteIds","connectedDeviceIds"]},"Device":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"siteId":{"type":["string","null"],"format":"cuid","description":"The unique identifier for the site this device belongs to.","example":"cllgn0u4r000008l7eazybfbo"},"name":{"type":"string","description":"The name of the device."},"manufacturerDeviceId":{"type":"string","description":"The unique identifier for the device issued by the manufacturer.","example":"b1143000-69ac-481f-9bef-4bfd96198133"},"serialNumber":{"type":["string","null"],"description":"The serial number of the device.","example":"123456789"},"referenceId":{"type":"string","description":"A unique identifier referring to the user/account in your system","example":"2952bc94-0273-4087-830b-d0ab2bece1e7"},"manufacturer":{"type":"string","description":"The manufacturer of the device.","example":"ecobee"},"type":{"type":"string","enum":["battery","charger","inverter","meter","thermostat","vehicle","other","unknown"],"description":"The type of the device.","example":"thermostat"},"model":{"type":"string","description":"The name of the device model.","example":"nikeSmart"},"rawType":{"type":["string","null"],"description":"The raw device type as provided by the manufacturer.","example":"Battery Storage System"},"rawModel":{"type":["string","null"],"description":"The raw device model as provided by the manufacturer.","example":"ACME-BATTERY-PRO-13.5"},"modelYear":{"type":["integer","null"],"description":"The year the device was manufactured.","example":2021},"state":{"anyOf":[{"type":"object","properties":{"chargingState":{"type":"string","enum":["charging","discharging","idle","unknown"],"description":"Whether the battery is currently charging. The state could be unknown if not provided by the manufacturer."},"charge":{"type":"number","description":"The current charge of the battery in watt-hours (Wh)."},"chargePercentage":{"type":"number","minimum":0,"maximum":100,"description":"The current charge of the battery as a percentage. Represented as a number between 0 and 100."},"chargeRate":{"type":"number","description":"The current charge rate of the battery in watts (W)."},"backupReserve":{"type":"number","minimum":0,"maximum":100,"description":"The charge percentage that should be reserved for backup power. Represented as a number between 0 and 100."},"isStormModeActive":{"type":"boolean","description":"Whether the battery has an active storm mode alert."},"isStormModeEnabled":{"type":"boolean","description":"Whether the battery has storm mode enabled."},"strategy":{"type":"string","enum":["unknown","self_consumption","time_of_use","backup"],"default":"unknown","description":"The current strategy or mode the battery is operating in."},"gridStatus":{"type":"string","enum":["exporting","importing","idle","unknown"],"description":"The current grid status (importing, exporting, idle, unknown)."},"gridPower":{"type":"integer","description":"The recent estimate of power output to/from the grid in Watts (W). Positive values indicate importing from the grid, negative values indicate exporting to the grid."},"gridEnergy":{"type":"integer","description":"Estimated recent grid energy usage in Watt-hours (Wh)."},"loadPower":{"type":"number","minimum":0,"description":"The measured or projected power consumption for the home load during the measurement interval in Watts (W)."},"loadEnergy":{"type":"number","minimum":0,"description":"The measured or projected energy usage for the home load during the measurement interval in Watt-hours (Wh)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"},"whConsumed":{"type":["number","null"]}},"required":["chargingState","charge","chargePercentage","id","createdAt","whConsumed"],"title":"BatteryState"},{"type":"object","properties":{"chargingState":{"type":"string","enum":["charging","discharging","idle","unknown"],"description":"Whether the charger is currently charging. The state could be unknown if not provided by the manufacturer."},"isPluggedIn":{"type":"boolean","description":"Whether the charger is plugged in."},"chargerVoltage":{"type":"number","minimum":0,"maximum":1000,"description":"The voltage of the charger in volts (V)."},"chargerCurrent":{"type":"number","minimum":0,"maximum":1000,"description":"The current of the charger in amps (A)."},"chargerWattage":{"type":"number","minimum":0,"maximum":100000,"description":"The wattage of the charger in watts (W)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["chargingState","id","createdAt"],"title":"ChargerState"},{"type":"object","properties":{"ambientTemperature":{"type":"number","description":"The ambient temperature in degrees Fahrenheit."},"operatingMode":{"type":"string","enum":["heat","cool","auto","eco","off","unknown"],"description":"The current operating mode of the thermostat."},"coolTarget":{"type":"number","description":"The current target temperature for the cooling function in degrees Fahrenheit."},"heatTarget":{"type":"number","description":"The current target temperature for the heating function in degrees Fahrenheit."},"fanMode":{"type":"string","enum":["auto","on","off","circulate","unknown"],"description":"The current fan mode of the thermostat."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["ambientTemperature","operatingMode","fanMode","id","createdAt"],"title":"ThermostatState"},{"type":"object","properties":{"power":{"type":"number","minimum":0,"maximum":10000000,"description":"The power output of the inverter in watts (W)."},"generatedEnergy":{"type":"number","minimum":0,"description":"The energy generated by the inverter during the measurement interval in watt-hours (Wh)."},"lifetimeEnergyGenerated":{"type":"number","minimum":0,"description":"The cumulative energy generated by the inverter over its lifetime in watt-hours (Wh)."},"gridStatus":{"type":"string","enum":["exporting","importing","idle","unknown"],"description":"The current grid status (importing, exporting, idle, unknown)."},"gridPower":{"type":"integer","description":"The recent estimate of power output to/from the grid in Watts (W). Positive values indicate importing from the grid, negative values indicate exporting to the grid."},"gridEnergy":{"type":"integer","description":"Estimated recent grid energy usage in Watt-hours (Wh)."},"loadPower":{"type":"number","minimum":0,"description":"The measured or projected power consumption for the home load during the measurement interval in Watts (W)."},"loadEnergy":{"type":"number","minimum":0,"description":"The measured or projected energy usage for the home load during the measurement interval in Watt-hours (Wh)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["power","id","createdAt"],"title":"InverterState"},{"type":"object","properties":{"chargingState":{"type":"string","enum":["charging","discharging","idle","unknown"],"description":"Whether the vehicle is currently charging. The state could be unknown if not provided by the manufacturer."},"chargePercentage":{"type":"number","minimum":0,"maximum":100,"description":"The current charge of the vehicle as a percentage. Represented as a number between 0 and 100."},"chargeCompletedAt":{"type":"string","format":"date-time","description":"The estimated date and time when the vehicle will be fully charged."},"chargeLimit":{"type":"number","description":"The current charge limit of the vehicle as a percentage."},"charge":{"type":"number","minimum":0,"description":"The current charge of the vehicle battery in watt-hours (Wh)."},"isPluggedIn":{"type":"boolean","description":"Whether the vehicle is plugged in."},"chargerVoltage":{"type":"number","minimum":0,"maximum":1000,"description":"The voltage of the charger in volts (V)."},"chargerCurrent":{"type":"number","minimum":0,"maximum":1000,"description":"The current of the charger in amps (A)."},"chargerWattage":{"type":"number","minimum":0,"maximum":100000,"description":"The wattage of the charger in watts (W)."},"range":{"type":"number","minimum":0,"maximum":10000,"description":"The current (estimated) range of the vehicle in miles (mi)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["chargingState","chargePercentage","range","id","createdAt"],"title":"VehicleState"}],"description":"The current state of the device.","example":{"id":"cllgn0u4r000008l7eazybfbo","ambientTemperature":72.3,"operatingMode":"auto","heatTarget":72.5,"coolTarget":75.5,"fanMode":"auto","createdAt":"2024-04-01T00:00:00.000Z"}},"staticState":{"anyOf":[{"type":"object","properties":{"capacity":{"type":"number","description":"The rated maximum capacity of the battery in watt-hours (Wh)."},"maxChargeRate":{"type":"number","description":"The rated maximum charge rate of the battery in watts (W)."},"maxDischargeRate":{"type":"number","description":"The rated maximum discharge rate of the battery in watts (W)."},"numberOfBatteries":{"type":"integer","exclusiveMinimum":0,"description":"The number of batteries in the system."}},"required":["capacity"],"title":"BatteryStaticState"},{"type":"object","properties":{"power":{"type":"number","minimum":0,"maximum":10000000,"description":"The maximum power output of the inverter in watts (W)."}},"required":["power"],"title":"InverterStaticState"},{"type":"object","properties":{"allowedModes":{"type":"array","items":{"type":"string","enum":["heat","cool","auto","eco","off","unknown"]},"description":"Operating modes supported by this thermostat."},"minHeatSetpoint":{"type":"integer","description":"Minimum heat setpoint temperature in degrees Fahrenheit."},"maxHeatSetpoint":{"type":"integer","description":"Maximum heat setpoint temperature in degrees Fahrenheit."},"minCoolSetpoint":{"type":"integer","description":"Minimum cool setpoint temperature in degrees Fahrenheit."},"maxCoolSetpoint":{"type":"integer","description":"Maximum cool setpoint temperature in degrees Fahrenheit."},"allowedFanModes":{"type":"array","items":{"type":"string","enum":["auto","on","off","circulate","unknown"]},"description":"Fan modes supported by this thermostat."},"extendedCapabilities":{"type":"object","additionalProperties":{},"description":"Extended capabilities including scheduling support, deadband settings, and mode-specific temperature constraints. Flexible structure for manufacturer-specific features."}},"required":["allowedModes","allowedFanModes"],"title":"ThermostatStaticState"},{"type":"object","properties":{"capacity":{"type":"number","description":"The rated maximum capacity of the vehicle battery in watt-hours (Wh)."}},"required":["capacity"],"title":"VehicleStaticState"}],"description":"Static state of the device.","example":{"capacity":13500,"maxChargeRate":5000,"maxDischargeRate":11500}},"location":{"type":"object","properties":{"address":{"type":"object","properties":{"streetOne":{"type":["string","null"]},"streetTwo":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"country":{"type":["string","null"]},"county":{"type":["string","null"]},"hashedAddress":{"type":["string","null"]}}},"coordinates":{"type":"object","properties":{"latitude":{"type":"number"},"longitude":{"type":"number"}},"required":["latitude","longitude"]}},"required":["address"],"description":"The location of the device.","example":{"address":{"streetOne":"123 Main St","streetTwo":"Apt 101","city":"Beverly Hills","state":"CA","postalCode":"90210","country":"USA"},"coordinates":{"latitude":34.1,"longitude":-118.3}}},"availableCommands":{"type":"array","items":{"$ref":"#/components/schemas/CommandType"},"description":"The list of commands that can be sent to the device.","examples":[[{"slug":"thermostat:set-operating-mode","description":"Sets the operating mode of the thermostat."},{"slug":"thermostat:set-fan-mode","description":"Sets the fan mode of the thermostat."}]]},"tags":{"type":"array","items":{"type":"string"},"description":"The list of tags associated with the device.","example":["bedroom","upstairs"]},"createdAt":{"type":["string","null"],"format":"date-time","description":"The date and time that this device was created.","example":"2024-04-01T00:00:00.000Z"},"updatedAt":{"type":["string","null"],"format":"date-time","description":"The date and time that this device was last updated.","example":"2024-04-01T00:00:00.000Z"}},"required":["id","name","manufacturerDeviceId","referenceId","manufacturer","type","model","state","availableCommands","tags","createdAt"]},"DeviceCommandsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Command"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]},"DeviceHistoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"chargingState":{"type":"string","enum":["charging","discharging","idle","unknown"],"description":"Whether the battery is currently charging. The state could be unknown if not provided by the manufacturer."},"charge":{"type":"number","description":"The current charge of the battery in watt-hours (Wh)."},"chargePercentage":{"type":"number","minimum":0,"maximum":100,"description":"The current charge of the battery as a percentage. Represented as a number between 0 and 100."},"chargeRate":{"type":"number","description":"The current charge rate of the battery in watts (W)."},"backupReserve":{"type":"number","minimum":0,"maximum":100,"description":"The charge percentage that should be reserved for backup power. Represented as a number between 0 and 100."},"isStormModeActive":{"type":"boolean","description":"Whether the battery has an active storm mode alert."},"isStormModeEnabled":{"type":"boolean","description":"Whether the battery has storm mode enabled."},"strategy":{"type":"string","enum":["unknown","self_consumption","time_of_use","backup"],"default":"unknown","description":"The current strategy or mode the battery is operating in."},"gridStatus":{"type":"string","enum":["exporting","importing","idle","unknown"],"description":"The current grid status (importing, exporting, idle, unknown)."},"gridPower":{"type":"integer","description":"The recent estimate of power output to/from the grid in Watts (W). Positive values indicate importing from the grid, negative values indicate exporting to the grid."},"gridEnergy":{"type":"integer","description":"Estimated recent grid energy usage in Watt-hours (Wh)."},"loadPower":{"type":"number","minimum":0,"description":"The measured or projected power consumption for the home load during the measurement interval in Watts (W)."},"loadEnergy":{"type":"number","minimum":0,"description":"The measured or projected energy usage for the home load during the measurement interval in Watt-hours (Wh)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"},"whConsumed":{"type":["number","null"]}},"required":["chargingState","charge","chargePercentage","id","createdAt","whConsumed"],"title":"BatteryState"},{"type":"object","properties":{"chargingState":{"type":"string","enum":["charging","discharging","idle","unknown"],"description":"Whether the charger is currently charging. The state could be unknown if not provided by the manufacturer."},"isPluggedIn":{"type":"boolean","description":"Whether the charger is plugged in."},"chargerVoltage":{"type":"number","minimum":0,"maximum":1000,"description":"The voltage of the charger in volts (V)."},"chargerCurrent":{"type":"number","minimum":0,"maximum":1000,"description":"The current of the charger in amps (A)."},"chargerWattage":{"type":"number","minimum":0,"maximum":100000,"description":"The wattage of the charger in watts (W)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["chargingState","id","createdAt"],"title":"ChargerState"},{"type":"object","properties":{"ambientTemperature":{"type":"number","description":"The ambient temperature in degrees Fahrenheit."},"operatingMode":{"type":"string","enum":["heat","cool","auto","eco","off","unknown"],"description":"The current operating mode of the thermostat."},"coolTarget":{"type":"number","description":"The current target temperature for the cooling function in degrees Fahrenheit."},"heatTarget":{"type":"number","description":"The current target temperature for the heating function in degrees Fahrenheit."},"fanMode":{"type":"string","enum":["auto","on","off","circulate","unknown"],"description":"The current fan mode of the thermostat."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["ambientTemperature","operatingMode","fanMode","id","createdAt"],"title":"ThermostatState"},{"type":"object","properties":{"power":{"type":"number","minimum":0,"maximum":10000000,"description":"The power output of the inverter in watts (W)."},"generatedEnergy":{"type":"number","minimum":0,"description":"The energy generated by the inverter during the measurement interval in watt-hours (Wh)."},"lifetimeEnergyGenerated":{"type":"number","minimum":0,"description":"The cumulative energy generated by the inverter over its lifetime in watt-hours (Wh)."},"gridStatus":{"type":"string","enum":["exporting","importing","idle","unknown"],"description":"The current grid status (importing, exporting, idle, unknown)."},"gridPower":{"type":"integer","description":"The recent estimate of power output to/from the grid in Watts (W). Positive values indicate importing from the grid, negative values indicate exporting to the grid."},"gridEnergy":{"type":"integer","description":"Estimated recent grid energy usage in Watt-hours (Wh)."},"loadPower":{"type":"number","minimum":0,"description":"The measured or projected power consumption for the home load during the measurement interval in Watts (W)."},"loadEnergy":{"type":"number","minimum":0,"description":"The measured or projected energy usage for the home load during the measurement interval in Watt-hours (Wh)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["power","id","createdAt"],"title":"InverterState"},{"type":"object","properties":{"chargingState":{"type":"string","enum":["charging","discharging","idle","unknown"],"description":"Whether the vehicle is currently charging. The state could be unknown if not provided by the manufacturer."},"chargePercentage":{"type":"number","minimum":0,"maximum":100,"description":"The current charge of the vehicle as a percentage. Represented as a number between 0 and 100."},"chargeCompletedAt":{"type":"string","format":"date-time","description":"The estimated date and time when the vehicle will be fully charged."},"chargeLimit":{"type":"number","description":"The current charge limit of the vehicle as a percentage."},"charge":{"type":"number","minimum":0,"description":"The current charge of the vehicle battery in watt-hours (Wh)."},"isPluggedIn":{"type":"boolean","description":"Whether the vehicle is plugged in."},"chargerVoltage":{"type":"number","minimum":0,"maximum":1000,"description":"The voltage of the charger in volts (V)."},"chargerCurrent":{"type":"number","minimum":0,"maximum":1000,"description":"The current of the charger in amps (A)."},"chargerWattage":{"type":"number","minimum":0,"maximum":100000,"description":"The wattage of the charger in watts (W)."},"range":{"type":"number","minimum":0,"maximum":10000,"description":"The current (estimated) range of the vehicle in miles (mi)."},"id":{"type":"string","format":"cuid","description":"The unique identifier for the recorded state.","example":"cllgn0u4r000008l7eazybfbo"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the device state was recorded.","example":"2021-03-10T18:00:00.000Z"}},"required":["chargingState","chargePercentage","range","id","createdAt"],"title":"VehicleState"}]}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]},"DeviceSchedule":{"type":"object","properties":{"deviceTimezone":{"type":"string","description":"A valid timezone string","example":"America/New_York"},"startsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule starts.","example":"2021-04-01T00:00:00.000Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule ends.","example":"2021-04-01T00:00:00.000Z"},"defaultDeviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}},"id":{"type":"string","description":"The unique identifier for the device schedule.","example":"clpkn2je80006102tx7d0jhb8","readOnly":true},"deviceId":{"type":"string","description":"The device ID that this schedule belongs to.","example":"clpkn2je80006102tx7d0jhb8"},"rules":{"type":"array","items":{"type":"object","properties":{"daysOfWeek":{"type":"array","items":{"type":"integer"},"example":[0,1,2,3,4,5,6],"description":"The days of the week the rule is active, numbered 0-6, where 0 is Sunday. In the example the rule is active every day of the week."},"startTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"endTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"deviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}}},"required":["daysOfWeek","startTime","endTime","deviceOperatingMode"]}},"createdAt":{"type":"string","format":"date-time","description":"The date and time that this schedule was created.","example":"2021-04-01T00:00:00.000Z","readOnly":true},"updatedAt":{"type":"string","format":"date-time","description":"The date and time that this schedule was last updated.","example":"2021-04-01T00:00:00.000Z","readOnly":true}},"required":["defaultDeviceOperatingMode","id","deviceId","rules","createdAt"]},"DevicesResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Device"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]},"DeviceTypes":{"type":"array","items":{"type":"string","enum":["battery","charger","inverter","meter","thermostat","vehicle","other","unknown"]}},"Eligibility":{"type":"object","properties":{"status":{"type":"string","enum":["candidate","eligible","ineligible","submitted","approved","rejected","unenrolling","unenrolled"]},"reason":{"type":"string","description":"The reason for the eligibility status.","example":"The customer is already enrolled in another program."},"programInstanceId":{"type":"string","description":"The unique identifier for the program instance.","example":"cllgn0u4r000008l7eazybfbo"}},"required":["status"]},"EnergyModelingData":{"type":"object","properties":{"consumption":{"type":["object","null"],"properties":{"buildingCharacteristics":{"type":["object","null"],"properties":{"type":{"type":["string","null"],"description":"The type of the building.","example":"Residential"},"floorArea":{"type":["number","null"],"description":"The floor area of the building.","example":1000},"numStories":{"type":["number","null"],"description":"The number of stories in the building.","example":1},"numBedrooms":{"type":["number","null"],"description":"The number of bedrooms in the building.","example":1},"numOccupants":{"type":["number","null"],"description":"The number of occupants in the building.","example":1}}}}},"costs":{"type":["object","null"],"properties":{"utilityRates":{"type":["object","null"],"properties":{"electricity":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the electricity cost.","example":0.1},"units":{"type":["string","null"],"description":"The units of the electricity cost.","example":"kWh"}}},"fossilFuel":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the fossil fuel cost.","example":0.1},"units":{"type":["string","null"],"description":"The units of the fossil fuel cost.","example":"kWh"}}}}},"emissionRates":{"type":["object","null"],"properties":{"electricity":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the electricity emission rate.","example":0.1},"units":{"type":["string","null"],"description":"The units of the electricity emission rate.","example":"kgCO2e/kWh"}}},"fossilFuel":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the fossil fuel emission rate.","example":0.1},"units":{"type":["string","null"],"description":"The units of the fossil fuel emission rate.","example":"kgCO2e/kWh"}}}}}}},"intervals":{"type":["array","null"],"items":{"type":"object","properties":{"from":{"type":"string","format":"date-time","description":"The start date and time of the interval.","example":"2024-04-01T00:00:00.000Z"},"to":{"type":"string","format":"date-time","description":"The end date and time of the interval.","example":"2024-04-01T00:00:00.000Z"},"grid":{"type":["object","null"],"properties":{"import":{"type":["object","null"],"properties":{"electricity":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the grid electricity.","example":0.1},"units":{"type":["string","null"],"description":"The units of the grid electricity.","example":"kWh"}}},"fossilFuel":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the grid fossil fuel.","example":0.1},"units":{"type":["string","null"],"description":"The units of the grid fossil fuel.","example":"kWh"}}}}},"costs":{"type":["object","null"],"properties":{}}}},"costs":{"type":["object","null"],"properties":{"electricity":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the electricity cost.","example":0.1},"units":{"type":["string","null"],"description":"The units of the electricity cost.","example":"kWh"}}},"fossilFuel":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the fossil fuel cost.","example":0.1},"units":{"type":["string","null"],"description":"The units of the fossil fuel cost.","example":"kWh"}}}}},"consumption":{"type":["object","null"],"properties":{"electricity":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the electricity consumption.","example":0.1},"units":{"type":["string","null"],"description":"The units of the electricity consumption.","example":"kWh"}}},"fossilFuel":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the fossil fuel consumption.","example":0.1},"units":{"type":["string","null"],"description":"The units of the fossil fuel consumption.","example":"kWh"}}}}},"emissions":{"type":["object","null"],"properties":{"electricity":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the electricity emissions.","example":0.1},"units":{"type":["string","null"],"description":"The units of the electricity emissions.","example":"kgCO2e/kWh"}}},"fossilFuel":{"type":["object","null"],"properties":{"value":{"type":["number","null"],"description":"The value of the fossil fuel emissions.","example":0.1},"units":{"type":["string","null"],"description":"The units of the fossil fuel emissions.","example":"kgCO2e/kWh"}}}}}},"required":["from","to"]}}},"description":"The energy modeling data for the Site. Only available for workspaces with an enabled site intelligence integration."},"Enrollment":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the enrollment","example":"cllgn0u4r000008l7eazybfbo"},"leadId":{"type":"string","description":"The unique identifier for the lead","example":"cllgn0u4r000008l7eazybfbo"},"customerId":{"type":"string","description":"The unique identifier for the customer","example":"cllgn0u4r000008l7eazybfbo"},"firstName":{"type":"string","description":"The first name of the customer","example":"Suzie"},"lastName":{"type":"string","description":"The last name of the customer","example":"Homeowner"},"email":{"type":"string","format":"email","description":"The email address of the customer","example":"suzie.homeowner@example.com"},"phone":{"type":["string","null"],"description":"The phone number of the customer","example":"+1234567890"},"manufacturerSlugs":{"type":"array","items":{"type":"string"},"default":[],"description":"The slugs of the manufacturers associated with this enrollment","example":["tesla","enphase"]},"meta":{"type":"object","additionalProperties":{},"description":"Additional metadata as key-value pairs."},"serialNumber":{"type":["string","null"],"description":"The serial number of the device","example":"1234567890"},"referenceId":{"type":"string","description":"The reference ID of the customer","example":"1234567890"},"referenceDescription":{"type":["string","null"],"description":"The description of the reference ID","example":"Tesla Grid Services id."},"programInstanceId":{"type":"string","description":"The unique identifier for the program instance","example":"cllgn0u4r000008l7eazybfbo"},"enrollmentStartDate":{"type":["string","null"],"description":"The start date of the enrollment","example":"2025-01-01T00:00:00Z"},"tags":{"type":"array","items":{"type":"string"},"default":[],"description":"The tags for the enrollment.","example":["tag1","tag2"]},"devices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"}},"required":["id","type"]},"default":[],"description":"The devices associated with this enrollment","example":[{"id":"cllgn0u4r000008l7eazyefgh","type":"battery"}]},"address":{"$ref":"#/components/schemas/Address"},"eligibility":{"$ref":"#/components/schemas/Eligibility"},"createdAt":{"type":["string","null"],"description":"The date the enrollment was created","example":"2025-01-01T00:00:00Z"},"updatedAt":{"type":["string","null"],"description":"The date the enrollment was updated","example":"2025-01-01T00:00:00Z"}},"required":["id","eligibility"]},"EnrollmentInput":{"anyOf":[{"type":"object","properties":{"identificationType":{"type":"string","enum":["customerInfo"]},"firstName":{"type":"string","description":"The first name of the customer","example":"John"},"lastName":{"type":"string","description":"The last name of the customer","example":"Doe"},"email":{"type":"string","format":"email","description":"The email address of the customer","example":"john.doe@example.com"},"address":{"$ref":"#/components/schemas/Address"},"phone":{"type":["string","null"],"description":"The phone number of the customer.","example":"+1234567890"},"manufacturerSlugs":{"type":"array","items":{"type":"string"},"default":[],"description":"Optional array of manufacturer slugs associated with this enrollment. Defaults to empty array if not provided.","example":["tesla","enphase"]},"meta":{"type":"object","additionalProperties":{},"description":"Additional metadata as key-value pairs."},"serialNumber":{"type":["string","null"],"description":"The serial number of the device.","example":"1234567890"},"referenceId":{"type":"string","description":"The reference ID of the customer.","example":"1234567890"},"referenceDescription":{"type":["string","null"],"description":"The description of the reference ID.","example":"The customer is a new lead."},"tags":{"type":"array","items":{"type":"string"},"default":[],"description":"The tags for the enrollment.","example":["tag1","tag2"]},"enrollmentStartDate":{"type":["string","null"],"description":"The start date of the enrollment.","example":"2025-01-01T00:00:00Z"},"eligibility":{"type":"object","properties":{"status":{"type":"string","enum":["candidate","eligible","ineligible","submitted","approved","rejected","unenrolling","unenrolled"]},"reason":{"type":"string"}},"required":["status"],"description":"Initial eligibility status for the enrollment. If not provided, eligibility will be determined automatically."}},"required":["identificationType","firstName","lastName","email","address"],"title":"Customer Info Enrollment"},{"type":"object","properties":{"identificationType":{"type":"string","enum":["customerId"]},"customerId":{"type":"string","description":"The unique identifier for the customer","example":"cllgn0u4r000008l7eazybfbo"},"address":{"$ref":"#/components/schemas/Address"},"phone":{"type":["string","null"],"description":"The phone number of the customer.","example":"+1234567890"},"manufacturerSlugs":{"type":"array","items":{"type":"string"},"default":[],"description":"Optional array of manufacturer slugs associated with this enrollment. Defaults to empty array if not provided.","example":["tesla","enphase"]},"meta":{"type":"object","additionalProperties":{},"description":"Additional metadata as key-value pairs."},"serialNumber":{"type":["string","null"],"description":"The serial number of the device.","example":"1234567890"},"referenceId":{"type":"string","description":"The reference ID of the customer.","example":"1234567890"},"referenceDescription":{"type":["string","null"],"description":"The description of the reference ID.","example":"The customer is a new lead."},"tags":{"type":"array","items":{"type":"string"},"default":[],"description":"The tags for the enrollment.","example":["tag1","tag2"]},"enrollmentStartDate":{"type":["string","null"],"description":"The start date of the enrollment.","example":"2025-01-01T00:00:00Z"},"eligibility":{"type":"object","properties":{"status":{"type":"string","enum":["candidate","eligible","ineligible","submitted","approved","rejected","unenrolling","unenrolled"]},"reason":{"type":"string"}},"required":["status"],"description":"Initial eligibility status for the enrollment. If not provided, eligibility will be determined automatically."}},"required":["identificationType","customerId"],"title":"Customer ID Enrollment"},{"type":"object","properties":{"identificationType":{"type":"string","enum":["enrollmentId"]},"enrollmentId":{"type":"string","description":"The unique identifier for the enrollment","example":"cllgn0u4r000008l7eazybfbo"},"address":{"$ref":"#/components/schemas/Address"},"phone":{"type":["string","null"],"description":"The phone number of the customer.","example":"+1234567890"},"manufacturerSlugs":{"type":"array","items":{"type":"string"},"default":[],"description":"Optional array of manufacturer slugs associated with this enrollment. Defaults to empty array if not provided.","example":["tesla","enphase"]},"meta":{"type":"object","additionalProperties":{},"description":"Additional metadata as key-value pairs."},"serialNumber":{"type":["string","null"],"description":"The serial number of the device.","example":"1234567890"},"referenceId":{"type":"string","description":"The reference ID of the customer.","example":"1234567890"},"referenceDescription":{"type":["string","null"],"description":"The description of the reference ID.","example":"The customer is a new lead."},"tags":{"type":"array","items":{"type":"string"},"default":[],"description":"The tags for the enrollment.","example":["tag1","tag2"]},"enrollmentStartDate":{"type":["string","null"],"description":"The start date of the enrollment.","example":"2025-01-01T00:00:00Z"},"eligibility":{"type":"object","properties":{"status":{"type":"string","enum":["candidate","eligible","ineligible","submitted","approved","rejected","unenrolling","unenrolled"]},"reason":{"type":"string"}},"required":["status"],"description":"Initial eligibility status for the enrollment. If not provided, eligibility will be determined automatically."}},"required":["identificationType","enrollmentId"],"title":"Enrollment ID Enrollment"},{"type":"object","properties":{"identificationType":{"type":"string","enum":["leadId"]},"leadId":{"type":"string","description":"The unique identifier for the lead","example":"cllgn0u4r000008l7eazybfbo"},"address":{"$ref":"#/components/schemas/Address"},"phone":{"type":["string","null"],"description":"The phone number of the customer.","example":"+1234567890"},"manufacturerSlugs":{"type":"array","items":{"type":"string"},"default":[],"description":"Optional array of manufacturer slugs associated with this enrollment. Defaults to empty array if not provided.","example":["tesla","enphase"]},"meta":{"type":"object","additionalProperties":{},"description":"Additional metadata as key-value pairs."},"serialNumber":{"type":["string","null"],"description":"The serial number of the device.","example":"1234567890"},"referenceId":{"type":"string","description":"The reference ID of the customer.","example":"1234567890"},"referenceDescription":{"type":["string","null"],"description":"The description of the reference ID.","example":"The customer is a new lead."},"tags":{"type":"array","items":{"type":"string"},"default":[],"description":"The tags for the enrollment.","example":["tag1","tag2"]},"enrollmentStartDate":{"type":["string","null"],"description":"The start date of the enrollment.","example":"2025-01-01T00:00:00Z"},"eligibility":{"type":"object","properties":{"status":{"type":"string","enum":["candidate","eligible","ineligible","submitted","approved","rejected","unenrolling","unenrolled"]},"reason":{"type":"string"}},"required":["status"],"description":"Initial eligibility status for the enrollment. If not provided, eligibility will be determined automatically."}},"required":["identificationType","leadId","address"],"title":"Lead ID Enrollment","deprecated":true}]},"GetProgramInstanceParams":{"type":"object","properties":{"instanceId":{"type":"string","description":"The ID of the program instance to retrieve.","example":"cllgn0u4r0000008l7eazybfbo"}},"required":["instanceId"]},"Interval":{"type":"object","properties":{"startDate":{"type":"string","format":"date-time","description":"The start date and time of the interval.","example":"2024-04-01T00:00:00.000Z"},"endDate":{"type":"string","format":"date-time","description":"The end date and time of the interval.","example":"2024-04-01T00:15:00.000Z"},"consumption":{"type":["number","null"],"description":"The amount of energy consumed during the interval.","example":3.2}},"required":["startDate","endDate"]},"LinkSessionResponse":{"type":"object","properties":{"customerId":{"type":"string","description":"The ID of the customer associated with the link session.","example":"cllh2buhk000008la0ln6cb80"},"linkUrl":{"type":"string","format":"uri","description":"The URL to redirect to in order to start the link session.","example":"https://connect.texturehq.com/link_e47b6d39dd3e6b3ab55969f55dc88ae6"},"linkToken":{"type":"string","description":"The token used to identify the link session.","example":"link_e47b6d39dd3e6b3ab55969f55dc88ae6"},"expiresAt":{"type":"string","format":"date-time","description":"The date and time when the link session will expire.","example":"2022-02-22T22:22:22Z"}},"required":["customerId","linkUrl","linkToken","expiresAt"]},"Manufacturers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"The name of the manufacturer.","example":"Tesla"},"slug":{"type":"string","description":"The unique string used internally to refer to the manufacturer.","example":"tesla"},"deviceTypes":{"type":"array","items":{"type":"string","enum":["battery","charger","inverter","meter","thermostat","vehicle","other","unknown"]},"description":"The types of devices that this manufacturer supports.","example":["battery"]}},"required":["name","slug","deviceTypes"]}},"Permit":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the permit.","example":"123"},"description":{"type":["string","null"],"description":"The description on the permit. This is a free-form text field that can contain any information about the permit.","example":"Install 27 kwh back-up batteries in cabinet"},"number":{"type":"string","description":"The permit number provided by the jurisdiction.","example":"B2303829"},"jurisdiction":{"type":"string","description":"The jurisdiction where permit was filled.","example":"Berkeley"},"jobValue":{"type":["number","null"],"description":"The reported job value on the permit in cents (integer value representing dollars * 100).","example":500100},"type":{"type":["string","null"],"description":"The type of permit.","example":"Building alteration: 3+ residential units or commercial"},"status":{"type":["string","null"],"description":"The status of the permit.","example":"active"},"fileDate":{"type":["string","null"],"description":"The date the permit was filed.","example":"2023-10-02"},"tags":{"type":["array","null"],"items":{"type":["string","null"]},"description":"The list of tags associated with the permit.","example":["solar","utilities","residential","solar_battery_storage"]}},"required":["id","number","jurisdiction"]},"PostAlertsBody":{"type":"object","properties":{"siteId":{"type":"string","format":"cuid","description":"The unique identifier of the site this alert is related to.","example":"cllgn0u4r000008l7eazybfbo"},"deviceId":{"type":["string","null"],"format":"cuid","description":"The unique identifier of the device this alert is related to.","example":"cllgn0u4r000008l7eazybfbo"},"title":{"type":"string","description":"The title of the alert.","example":"Device is offline"},"description":{"type":["string","null"],"description":"Additional description or details about the alert.","example":"The thermostat in the bedroom has been offline for 15 minutes."},"sourceSystem":{"type":"string","description":"The source system that generated the alert.","example":"texture"},"alertType":{"type":["string","null"],"description":"The type/category of the alert.","example":"device_offline"},"type":{"type":["string","null"],"enum":["COMMUNICATIONS","POWER_LIMIT","GRID_STATUS","HARDWARE_FAULT","FIRMWARE_UPDATE","CONFIGURATION","VOLTAGE_FREQUENCY","STATE_OF_ENERGY","TEMPERATURE","ISLANDING","GENERATOR","SOFTWARE_PROCESS","SENSOR","SYSTEM_SHUTDOWN","PERFORMANCE_DEGRADED","SITE_LEVEL","SAFETY","UNKNOWN",null],"description":"Normalized alert type. Defaults to UNKNOWN when omitted.","example":"HARDWARE_FAULT"},"subtype":{"type":["string","null"],"enum":["BATTERY_METER_COMMS","INVERTER_COMMS","PV_INVERTER_COMMS","SITE_CONTROLLER_COMMS","SITE_MAX_LIMITED","SITE_MIN_LIMITED","RAMP_RATE_LIMITED","POWER_FACTOR_LIMITED","GRID_FORMING","GRID_FOLLOWING","GRID_RESYNC_FAILED","INVERTER_FAULT","BATTERY_FAULT","CONTACTOR_FAULT","GENERATOR_FAULT","OPTICASTER_EXE_FAILED","CONTROL_AGENT_CRASHED","LOW_SOE","SLEEP_MODE","WAIT_FOR_SOLAR","EXTERNAL_SWITCH_SHUTDOWN","GPIO_SHUTDOWN","EXCESSIVE_VOLTAGE_DROP","FREQUENCY_DEVIATION","METER_DISCONNECTED","TEMPERATURE_SENSOR_FAULT","PERFORMANCE_BELOW_EXPECTATION",null],"description":"Optional normalized subtype.","example":"BATTERY_METER_COMMS"},"providerCode":{"type":["string","null"],"description":"Provider specific code associated with the alert.","example":"3019"},"providerName":{"type":["string","null"],"description":"Provider display name associated with the alert.","example":"Battery Meter Comms"},"severity":{"type":"string","enum":["CRITICAL","WARNING","INFO"],"description":"The severity level of the alert.","example":"WARNING"}},"required":["siteId","title","sourceSystem","severity"]},"Program":{"type":"object","properties":{"slug":{"type":"string","description":"The slug of the program. Machine-readable identifier.","example":"nyc-battery-program-2025"},"name":{"type":"string","description":"The name of the program.","example":"NYC Battery Program 2025"},"description":{"type":"string","description":"The description of the program.","example":"This program is for homeowners in NYC that have installed battery storage systems."},"endTime":{"type":"string","format":"date-time","description":"The end time of the program.","example":"2025-12-31T23:59:59Z"},"states":{"type":"array","items":{"type":"string","pattern":"^[A-Z]{2}$"},"description":"The states of the program.","example":["NY","NJ"]},"year":{"type":["integer","null"],"description":"The year of the program.","example":2025},"active":{"type":"boolean","description":"Whether the program is currently active.","example":true}},"required":["slug","name","description","states","year","active"]},"ProgramEvent":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the program event.","example":"cllgn0u4r000008l7eazybfbo"},"programInstanceId":{"type":"string","format":"cuid","description":"The unique identifier of the program instance this event belongs to.","example":"cllgn0u4r000008l7eazybfbo"},"type":{"type":"string","description":"The type of the program event.","example":"discharge"},"startsAt":{"type":"string","format":"date-time","description":"The date and time the program event starts.","example":"2025-01-01T00:00:00Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time the program event ends.","example":"2025-01-01T00:00:00Z"},"dispatches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the command batch.","example":"cllgn0u4r000008l7eazybfbo"},"startsAt":{"type":"string","format":"date-time","description":"The date and time the command batch starts.","example":"2025-01-01T00:00:00Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time the command batch ends.","example":"2025-01-01T00:00:00Z"},"type":{"type":"string","enum":["battery:set-reserve","battery:set-operating-mode","charger:set-operating-mode","thermostat:set-operating-mode","thermostat:set-fan-mode","thermostat:pause-schedule","thermostat:resume-schedule","vehicle:set-charge-limit","vehicle:set-operating-mode"],"description":"The unique slug representing the type of command.","example":"thermostat:set-operating-mode"},"issuedAt":{"type":"string","format":"date-time","description":"The date and time the command was issued."},"input":{"type":"object","properties":{},"additionalProperties":{},"description":"The input payload sent with the command. Includes necessary information for execution. Conforms to the schema provided on the command type.","example":{"operatingMode":"eco","heatTarget":70.5,"coolTarget":80.5}},"metrics":{"type":"object","properties":{"counts":{"type":"object","properties":{"total":{"type":"number","description":"Total number of commands in the batch","example":100},"pending":{"type":"number","description":"Number of pending commands","example":50},"scheduled":{"type":"number","description":"Number of commands scheduled","example":20},"completed":{"type":"number","description":"Number of completed commands","example":25},"failed":{"type":"number","description":"Number of failed commands","example":5}},"required":["total","pending","scheduled","completed","failed"],"description":"Counts of commands by their status within the batch"}},"required":["counts"],"description":"Metrics about the commands in the batch."}},"required":["id","startsAt","endsAt","type","issuedAt","input","metrics"]},"description":"The command batches associated with the program event."}},"required":["id","programInstanceId","type","startsAt","endsAt","dispatches"]},"ProgramInstance":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the program instance.","example":"cllgn0u4r000008l7eazybfbo"},"program":{"$ref":"#/components/schemas/Program"},"slug":{"type":"string","description":"The slug of the program instance.","example":"nyc-battery-program-2025-instance-1"},"title":{"type":"string","description":"The title of the program instance.","example":"NYC Battery Program 2025"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the program instance was created.","example":"2025-01-01T00:00:00Z"}},"required":["id","program","slug","title","createdAt"]},"PublicManufacturers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"The name of the manufacturer.","example":"Tesla"},"slug":{"type":"string","description":"The unique slug identifier for the manufacturer.","example":"tesla"},"supportLevel":{"type":"string","enum":["blocked","planned","development","uat","production"],"description":"The current support level of the manufacturer integration.","example":"production"},"supportsGridServices":{"type":"boolean","description":"Whether this manufacturer supports grid services.","example":true},"deviceTypes":{"type":"array","items":{"type":"string"},"description":"The types of devices this manufacturer supports.","example":["battery","inverter"]},"logoUrl":{"type":"string","description":"URL to the manufacturer's logo image.","example":"https://brands.texturehq.com/brands/icon/64/tesla.png"}},"required":["name","slug","supportLevel","supportsGridServices","deviceTypes","logoUrl"]}},"Site":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the Site issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"name":{"type":["string","null"],"description":"The name of the Site."},"referenceId":{"type":["string","null"],"description":"The reference ID of the Site.","example":"9bb290c8-fe97-46ce-92a8-952823164277"},"workspaceId":{"type":"string","format":"cuid","description":"The unique identifier for the Workspace to which the Site belongs, issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"createdAt":{"type":["string","null"],"format":"date-time","description":"The date and time that this Site was created.","example":"2024-04-01T00:00:00.000Z"},"updatedAt":{"type":["string","null"],"format":"date-time","description":"The date and time that this Site was last updated.","example":"2024-04-01T00:00:00.000Z"},"devices":{"type":"array","items":{"$ref":"#/components/schemas/Device"}},"connectedCustomers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the customer issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"workspaceId":{"type":"string","format":"cuid","description":"The unique identifier for the workspace issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"referenceId":{"type":["string","null"],"description":"The reference ID for the customer.","example":"01234567"},"firstName":{"type":["string","null"],"description":"The given name of the customer.","example":"John"},"lastName":{"type":["string","null"],"description":"The surname of the customer.","example":"Smith"},"email":{"type":["string","null"],"format":"email","description":"The email address of the customer.","example":"test@example.com"},"phone":{"type":["string","null"],"description":"The phone number of the customer as provided during creation or update.","example":"1234567890"},"devices":{"type":"array","items":{"$ref":"#/components/schemas/Device"},"description":"The devices connected to the customer."},"createdAt":{"type":["string","null"],"format":"date-time","description":"The date and time the customer was created in the system.","example":"2026-03-12T21:15:16.073Z"},"updatedAt":{"type":["string","null"],"format":"date-time","description":"The date and time the customer was last updated in the system.","example":"2026-03-12T21:15:16.073Z"}},"required":["id","workspaceId","referenceId","createdAt"]}},"location":{"type":"object","properties":{"streetOne":{"type":["string","null"],"description":"The first line of the street location.","example":"123 Main St"},"streetTwo":{"type":["string","null"],"description":"The second line of the street location.","example":"Apt 4B"},"city":{"type":["string","null"],"description":"The city of the location.","example":"Springfield"},"state":{"type":["string","null"],"description":"The state or province of the location.","example":"IL"},"postalCode":{"type":["string","null"],"description":"The postal or ZIP code of the location.","example":"62701"},"country":{"type":["string","null"],"description":"The country of the location.","example":"USA"},"latitude":{"type":["number","null"],"description":"The latitude coordinate of the location.","example":39.7817},"longitude":{"type":["number","null"],"description":"The longitude coordinate of the location.","example":-89.6501}}},"energyUsage":{"type":["array","null"],"items":{"type":"object","properties":{"startDate":{"type":"string","format":"date-time","description":"The start date and time of the energy usage period.","example":"2024-04-01T00:00:00.000Z"},"endDate":{"type":"string","format":"date-time","description":"The end date and time of the energy usage period.","example":"2024-04-01T00:00:00.000Z"},"consumption":{"type":"number","description":"Total energy consumed at the Site during the period.","example":100},"price":{"type":"number","description":"The price of the energy consumed during the period.","example":0.1},"emissions":{"type":"number","description":"The amount of emissions produced during the period.","example":0.1},"cost":{"type":"object","properties":{"amount":{"type":"integer","description":"The integer representation of the cost of the energy consumed during the period.","example":10},"currencyCode":{"type":"string","description":"The currency code of the cost.","example":"USD"},"formatted":{"type":"string","description":"The formatted cost of the energy consumed during the period.","example":"$10.00"}},"required":["amount","currencyCode","formatted"]}},"required":["startDate","endDate","consumption"]}},"utility":{"type":"object","properties":{"name":{"type":"string","description":"The name of the utility provider.","example":"Pacifc Gas and Electric"}},"required":["name"],"description":"The utility for the Site."},"wholesaleMarket":{"type":"object","properties":{"name":{"type":"string","description":"The name of the wholesale market.","example":"California Independent Systems Operator"}},"required":["name"],"description":"The wholesale market for the Site."},"weather":{"$ref":"#/components/schemas/WeatherData"},"permits":{"type":"array","items":{"$ref":"#/components/schemas/Permit"},"description":"The list of permits associated with the Site. Only available for workspaces with an enabled permits integration."},"energyModeling":{"$ref":"#/components/schemas/EnergyModelingData"},"intervals":{"type":"array","items":{"$ref":"#/components/schemas/Interval"},"description":"The list of intervals associated with the Site."}},"required":["id","workspaceId","createdAt"]},"Sites":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Site"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]},"TagSchedule":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the device schedule.","example":"clpkn2je80006102tx7d0jhb8","readOnly":true},"workspaceId":{"type":"string","description":"The workspace ID that this schedule belongs to.","example":"clpkn2je80006102tx7d0jhb8"},"tag":{"type":"string","description":"The tag that this schedule belongs to.","example":"tag-value"},"deviceType":{"type":"string","enum":["battery","thermostat","vehicle"],"description":"The device type that this schedule belongs to.","example":"thermostat"},"timezone":{"type":"string","description":"A valid timezone string","example":"America/New_York"},"startsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule starts.","example":"2021-04-01T00:00:00.000Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule ends.","example":"2021-04-01T00:00:00.000Z"},"defaultDeviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}},"rules":{"type":"array","items":{"type":"object","properties":{"daysOfWeek":{"type":"array","items":{"type":"integer"},"example":[0,1,2,3,4,5,6],"description":"The days of the week the rule is active, numbered 0-6, where 0 is Sunday. In the example the rule is active every day of the week."},"startTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"endTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"deviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}}},"required":["daysOfWeek","startTime","endTime","deviceOperatingMode"]}},"createdAt":{"type":"string","format":"date-time","description":"The date and time that this schedule was created.","example":"2021-04-01T00:00:00.000Z","readOnly":true},"updatedAt":{"type":"string","format":"date-time","description":"The date and time that this schedule was last updated.","example":"2021-04-01T00:00:00.000Z","readOnly":true}},"required":["id","workspaceId","tag","deviceType","timezone","startsAt","defaultDeviceOperatingMode","rules","createdAt"]},"WeatherData":{"type":"object","properties":{"provider":{"type":"string","description":"The provider of the weather data.","example":"OpenWeatherMap"},"dewPoint":{"type":["object","null"],"properties":{"unit":{"type":"string","description":"The unit of the dew point.","example":"C"},"value":{"type":"number","description":"The value of the dew point.","example":20}},"required":["unit","value"]},"humidity":{"type":["object","null"],"properties":{"unit":{"type":"string","description":"The unit of the humidity.","example":"%"},"value":{"type":"number","description":"The value of the humidity.","example":50}},"required":["unit","value"]},"temperature":{"type":["object","null"],"properties":{"unit":{"type":"string","description":"The unit of the temperature.","example":"C"},"value":{"type":"number","description":"The value of the temperature.","example":20}},"required":["unit","value"]},"conditions":{"type":["object","null"],"properties":{"unit":{"type":"string","description":"The unit of the conditions.","example":"Sunny"},"value":{"type":"string","description":"The value of the conditions.","example":"Sunny"}},"required":["unit","value"]},"cloudiness":{"type":["object","null"],"properties":{"unit":{"type":"string","description":"The unit of the cloudiness.","example":"%"},"value":{"type":"number","description":"The value of the cloudiness.","example":50}},"required":["unit","value"]},"sunrise":{"type":["object","null"],"properties":{"unit":{"type":"string","description":"The unit of the sunrise.","example":"iso8601"},"value":{"type":"string","description":"The value of the sunrise.","example":"2024-04-01T07:00:00.000Z"}},"required":["unit","value"]},"sunset":{"type":["object","null"],"properties":{"unit":{"type":"string","description":"The unit of the sunset.","example":"iso8601"},"value":{"type":"string","description":"The value of the sunset.","example":"2024-04-01T19:00:00.000Z"}},"required":["unit","value"]}},"required":["provider"],"description":"Current weather and forecast data for the site location. Only included when specifically requested."}},"parameters":{}},"paths":{"/alerts":{"get":{"description":"Get a list of alerts","summary":"Get all alerts for a workspace with additional optional filtering","tags":["alerts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid"},"required":false,"in":"query","name":"id","description":"Filter alerts by ID.","example":"clm1a2b3c4d5e6f7g8h9i0j1"},{"schema":{"type":"string"},"required":false,"in":"query","name":"externalId","description":"Filter alerts by external ID.","example":"124254116"},{"schema":{"type":"string","enum":["CRITICAL","WARNING","INFO"],"description":"The severity level of the alert.","example":"WARNING"},"required":false,"description":"Filter alerts by severity level.","in":"query","name":"severity"},{"schema":{"type":"string","enum":["OPEN","ACKNOWLEDGED","IGNORED","RESOLVED"],"description":"The current status of the alert.","example":"OPEN"},"required":false,"description":"Filter alerts by status.","in":"query","name":"status"},{"schema":{"type":"string"},"required":false,"in":"query","name":"deviceId","description":"Filter alerts by device ID.","example":"cllgn0u4r000008l7eazybfbo"},{"schema":{"type":"string"},"required":false,"in":"query","name":"siteId","description":"Filter alerts by site ID.","example":"cllgn0u4r000008l7eazybfbo"},{"schema":{"type":"string"},"required":false,"in":"query","name":"sourceSystem","description":"Filter alerts by source system.","example":"Inverter 01"},{"schema":{"type":"string"},"required":false,"in":"query","name":"manufacturerDeviceId","description":"Filter alerts by manufacturer device ID.","example":"123456"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Object with alerts data and pagination info","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Alert"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]}}}},"403":{"description":"Unauthorized"},"404":{"description":"Not found"}}},"post":{"description":"Create a new alert","summary":"Create a new alert for a workspace","tags":["alerts"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostAlertsBody"}}}},"responses":{"201":{"description":"Alert created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"400":{"description":"Invalid input or API key","content":{"text/plain":{"schema":{"type":"string","example":"Invalid input"}}}},"403":{"description":"Forbidden - insufficient permissions","content":{"text/plain":{"schema":{"type":"string","example":"Forbidden"}}}},"500":{"description":"Internal server error","content":{"text/plain":{"schema":{"type":"string","example":"Something went wrong"}}}}}}},"/alerts/{id}/acknowledge":{"patch":{"description":"Acknowledge an alert","summary":"Acknowledge an alert","tags":["alerts"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the alert issued by Texture.","example":"clm1a2b3c4d5e6f7g8h9i0j1"},"required":true,"description":"The unique identifier for the alert issued by Texture.","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"snoozeUntil":{"type":["string","null"],"format":"date-time","description":"Optional date and time to snooze alert until.","example":"2024-01-15T12:00:00Z"}}}}}},"responses":{"200":{"description":"Acknowledge an alert","content":{"application/json":{"schema":{"type":"object","properties":{"snoozeUntil":{"type":["string","null"],"format":"date-time","description":"Optional date and time to snooze alert until.","example":"2024-01-15T12:00:00Z"}}}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}}},"/alerts/{id}/ignore":{"patch":{"description":"Ignore an alert","summary":"Ignore an alert","tags":["alerts"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the alert issued by Texture.","example":"clm1a2b3c4d5e6f7g8h9i0j1"},"required":true,"description":"The unique identifier for the alert issued by Texture.","name":"id","in":"path"}],"responses":{"200":{"description":"Ignore an alert","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}}},"/alerts/{id}/resolve":{"patch":{"description":"Resolve an alert","summary":"Resolve an alert","tags":["alerts"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the alert issued by Texture.","example":"clm1a2b3c4d5e6f7g8h9i0j1"},"required":true,"description":"The unique identifier for the alert issued by Texture.","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the alert issued by Texture.","example":"clm1a2b3c4d5e6f7g8h9i0j1"}},"required":["id"]}}}},"responses":{"200":{"description":"Resolve an alert","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the alert issued by Texture.","example":"clm1a2b3c4d5e6f7g8h9i0j1"}},"required":["id"]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}}},"/batches/{id}":{"get":{"description":"Get details of a specific batch.","summary":"Get batch","tags":["Batches"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier of the batch","example":"cllgn0u4r000008l7eazybfb2"},"required":true,"description":"The unique identifier of the batch","name":"id","in":"path"}],"responses":{"200":{"description":"Batch details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the command batch.","example":"cllgn0u4r000008l7eazybfbo"},"startsAt":{"type":"string","format":"date-time","description":"The date and time the command batch starts.","example":"2025-01-01T00:00:00Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time the command batch ends.","example":"2025-01-01T00:00:00Z"},"type":{"type":"string","enum":["battery:set-reserve","battery:set-operating-mode","charger:set-operating-mode","thermostat:set-operating-mode","thermostat:set-fan-mode","thermostat:pause-schedule","thermostat:resume-schedule","vehicle:set-charge-limit","vehicle:set-operating-mode"],"description":"The unique slug representing the type of command.","example":"thermostat:set-operating-mode"},"issuedAt":{"type":"string","format":"date-time","description":"The date and time the command was issued."},"input":{"type":"object","properties":{},"additionalProperties":{},"description":"The input payload sent with the command. Includes necessary information for execution. Conforms to the schema provided on the command type.","example":{"operatingMode":"eco","heatTarget":70.5,"coolTarget":80.5}},"metrics":{"type":"object","properties":{"counts":{"type":"object","properties":{"total":{"type":"number","description":"Total number of commands in the batch","example":100},"pending":{"type":"number","description":"Number of pending commands","example":50},"scheduled":{"type":"number","description":"Number of commands scheduled","example":20},"completed":{"type":"number","description":"Number of completed commands","example":25},"failed":{"type":"number","description":"Number of failed commands","example":5}},"required":["total","pending","scheduled","completed","failed"],"description":"Counts of commands by their status within the batch"}},"required":["counts"],"description":"Metrics about the commands in the batch."}},"required":["id","startsAt","endsAt","type","issuedAt","input","metrics"]}}}}}},"delete":{"description":"Delete a batch by ID. This endpoint is not currently implemented.","summary":"Delete batch","tags":["Batches"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier of the batch","example":"cllgn0u4r000008l7eazybfb2"},"required":true,"description":"The unique identifier of the batch","name":"id","in":"path"}],"responses":{"501":{"description":"Not implemented","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message","example":"Not implemented"}},"required":["message"]}}}}}}},"/commands/battery/set-operating-mode":{"post":{"description":"Send set-operating-mode command to a battery.","summary":"Send set-operating-mode command to a battery.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"type":"object","properties":{"operatingMode":{"type":"string","enum":["charge","discharge","idle","reset"],"description":"The desired operating mode or charging state of the battery."},"minimumBatteryReserve":{"type":"number","minimum":0,"maximum":100,"description":"The target minimum battery reserve percentage when discharging."},"maximumBatteryReserve":{"type":"number","minimum":0,"maximum":100,"default":100,"description":"The target maximum battery reserve percentage when charging."},"enableGridInteraction":{"type":"boolean","default":false,"description":"Whether or not the battery should attempt to interact with the grid, only applies if the battery is able to interact with the grid and it aids in achieving the desired operating mode."},"executionPriority":{"type":"array","items":{"type":"string","enum":["grid_services","baseline"]},"default":["grid_services","baseline"],"description":"The execution priority overrides for the battery, this will be used to determine the order in which a battery command will attempt to be executed. By default, the battery will attempt to execute grid-services first, falling back to baseline battery control if grid-services is not available. To bypass the grid-services attempt, set this to an empty array, or specify only ['baseline']. The baseline priority is always attempted last (whether specified or not)."},"dischargePowerRate":{"type":"number","exclusiveMinimum":0,"description":"Target discharge rate in watts. Takes precedence over dischargePowerPercent and dischargeStrategy."},"dischargePowerPercent":{"type":"number","exclusiveMinimum":0,"maximum":100,"description":"Target discharge power as percentage of device maximum. Used only if dischargePowerRate not provided."},"dischargeStrategy":{"type":"string","enum":["smooth","max"],"description":"Discharge strategy. 'smooth' calculates power to discharge evenly over event duration. 'max' (default) discharges at maximum rate. Only used if dischargePowerRate and dischargePowerPercent are not provided."}},"required":["operatingMode"],"description":"The expected payload of the battery:set-operating-mode command."},"startAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the start of the override detection window. The command executes immediately regardless of this value. If omitted, monitoring begins at command completion.","example":"2026-02-12T18:00:00Z"},"endAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the end of the override detection window. When set, the system monitors the device for manual overrides until this time and emits a command.overridden webhook event if the device state diverges. This does not schedule the command — execution is immediate.","example":"2026-02-12T20:00:00Z"}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and it's status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/battery/set-operating-mode/batch":{"post":{"description":"Send set-operating-mode batch command to a group of batteries.","summary":"Send set-operating-mode batch command to a group of batteries.","tags":["Batch Commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tag":{"type":"string","description":"The tag for the group of batteries to target.","example":"my-battery-tag"},"input":{"type":"object","properties":{"operatingMode":{"type":"string","enum":["charge","discharge","idle","reset"],"description":"The desired operating mode or charging state of the battery."},"minimumBatteryReserve":{"type":"number","minimum":0,"maximum":100,"description":"The target minimum battery reserve percentage when discharging."},"maximumBatteryReserve":{"type":"number","minimum":0,"maximum":100,"default":100,"description":"The target maximum battery reserve percentage when charging."},"enableGridInteraction":{"type":"boolean","default":false,"description":"Whether or not the battery should attempt to interact with the grid, only applies if the battery is able to interact with the grid and it aids in achieving the desired operating mode."},"executionPriority":{"type":"array","items":{"type":"string","enum":["grid_services","baseline"]},"default":["grid_services","baseline"],"description":"The execution priority overrides for the battery, this will be used to determine the order in which a battery command will attempt to be executed. By default, the battery will attempt to execute grid-services first, falling back to baseline battery control if grid-services is not available. To bypass the grid-services attempt, set this to an empty array, or specify only ['baseline']. The baseline priority is always attempted last (whether specified or not)."},"dischargePowerRate":{"type":"number","exclusiveMinimum":0,"description":"Target discharge rate in watts. Takes precedence over dischargePowerPercent and dischargeStrategy."},"dischargePowerPercent":{"type":"number","exclusiveMinimum":0,"maximum":100,"description":"Target discharge power as percentage of device maximum. Used only if dischargePowerRate not provided."},"dischargeStrategy":{"type":"string","enum":["smooth","max"],"description":"Discharge strategy. 'smooth' calculates power to discharge evenly over event duration. 'max' (default) discharges at maximum rate. Only used if dischargePowerRate and dischargePowerPercent are not provided."}},"required":["operatingMode"],"description":"The expected payload of the battery:set-operating-mode command."}},"required":["tag","input"]}}}},"responses":{"202":{"description":"The list of commands that were sent to the group or batch of devices","content":{"application/json":{"schema":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/Command"},{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}]}}}}},"400":{"description":"There was an issue sending the batch command.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/battery/set-reserve":{"post":{"description":"Send set-reserve command to a battery.","summary":"Send set-reserve command to a battery.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"type":"object","properties":{"chargePercentage":{"type":"number","minimum":0,"maximum":100,"description":"The percentage of the battery to reserve."}},"required":["chargePercentage"],"description":"The expected payload of the battery:set-reserve command."},"startAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the start of the override detection window. The command executes immediately regardless of this value. If omitted, monitoring begins at command completion.","example":"2026-02-12T18:00:00Z"},"endAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the end of the override detection window. When set, the system monitors the device for manual overrides until this time and emits a command.overridden webhook event if the device state diverges. This does not schedule the command — execution is immediate.","example":"2026-02-12T20:00:00Z"}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and it's status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/charger/set-operating-mode":{"post":{"description":"Send set-operating-mode command to a charger.","summary":"Send set-operating-mode command to a charger.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"type":"object","properties":{"operatingMode":{"type":"string","enum":["start-charging","stop-charging"],"description":"The desired operating mode or charging state of the charger."}},"required":["operatingMode"],"description":"The expected payload of the charger:set-operating-mode command."},"startAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the start of the override detection window. The command executes immediately regardless of this value. If omitted, monitoring begins at command completion.","example":"2026-02-12T18:00:00Z"},"endAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the end of the override detection window. When set, the system monitors the device for manual overrides until this time and emits a command.overridden webhook event if the device state diverges. This does not schedule the command — execution is immediate.","example":"2026-02-12T20:00:00Z"}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and it's status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/thermostat/pause-schedule":{"post":{"description":"Pause the on-device thermostat schedule to allow Texture platform schedules to control the device.","summary":"Pause the on-device thermostat schedule.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"type":"object","properties":{},"description":"The expected payload of the thermostat:pause-schedule command. This command temporarily deactivates the on-device schedule without removing it."}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and it's status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/thermostat/resume-schedule":{"post":{"description":"Resume the on-device thermostat schedule after it has been paused.","summary":"Resume the on-device thermostat schedule.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"type":"object","properties":{},"description":"The expected payload of the thermostat:resume-schedule command. This command reactivates the on-device schedule after it has been paused."}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and it's status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/thermostat/set-fan-mode":{"post":{"description":"Send set-fan-mode command to a thermostat.","summary":"Send set-fan-mode command to a thermostat.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"anyOf":[{"type":"object","properties":{"fanMode":{"type":"string","enum":["auto"],"description":"Sets the thermostat fan mode to auto."}},"required":["fanMode"],"additionalProperties":false},{"type":"object","properties":{"fanMode":{"type":"string","enum":["on"],"description":"Sets the thermostat fan mode to on."}},"required":["fanMode"],"additionalProperties":false},{"type":"object","properties":{"fanMode":{"type":"string","enum":["circulate"],"description":"Sets the thermostat fan mode to circulate."}},"required":["fanMode"],"additionalProperties":false},{"type":"object","properties":{"fanMode":{"type":"string","enum":["off"],"description":"Sets the thermostat fan mode to off."}},"required":["fanMode"],"additionalProperties":false}],"description":"The expected payload of the thermostat:set-fan-mode command."},"startAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the start of the override detection window. The command executes immediately regardless of this value. If omitted, monitoring begins at command completion.","example":"2026-02-12T18:00:00Z"},"endAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the end of the override detection window. When set, the system monitors the device for manual overrides until this time and emits a command.overridden webhook event if the device state diverges. This does not schedule the command — execution is immediate.","example":"2026-02-12T20:00:00Z"}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and it's status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/thermostat/set-operating-mode":{"post":{"description":"Send set-operating-mode command to a thermostat.","summary":"Send set-operating-mode command to a thermostat.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"anyOf":[{"type":"object","properties":{"operatingMode":{"type":"string","enum":["off"],"description":"Sets the thermostat operating mode to off."}},"required":["operatingMode"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["heat"],"description":"Sets the thermostat operating mode to heat."},"heatTarget":{"type":"number","description":"The target temperature for heating in degrees Fahrenheit. Required for operating modes `heat`, `auto`, and `eco`."}},"required":["operatingMode","heatTarget"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["cool"],"description":"Sets the thermostat operating mode to cool."},"coolTarget":{"type":"number","description":"The target temperature for cooling in degrees Fahrenheit. Required for operating modes `cool`, `auto`, and `eco`."}},"required":["operatingMode","coolTarget"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["auto"],"description":"Sets the thermostat operating mode to auto."},"heatTarget":{"type":"number","description":"The target temperature for heating in degrees Fahrenheit. Required for operating modes `heat`, `auto`, and `eco`."},"coolTarget":{"type":"number","description":"The target temperature for cooling in degrees Fahrenheit. Required for operating modes `cool`, `auto`, and `eco`."}},"required":["operatingMode","heatTarget","coolTarget"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["eco"],"description":"Sets the thermostat operating mode to eco."},"heatTarget":{"type":"number","description":"The target temperature for heating in degrees Fahrenheit. Required for operating modes `heat`, `auto`, and `eco`."},"coolTarget":{"type":"number","description":"The target temperature for cooling in degrees Fahrenheit. Required for operating modes `cool`, `auto`, and `eco`."}},"required":["operatingMode","heatTarget","coolTarget"]}],"description":"The expected payload of the thermostat:set-operating-mode command."},"startAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the start of the override detection window. The command executes immediately regardless of this value. If omitted, monitoring begins at command completion.","example":"2026-02-12T18:00:00Z"},"endAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the end of the override detection window. When set, the system monitors the device for manual overrides until this time and emits a command.overridden webhook event if the device state diverges. This does not schedule the command — execution is immediate.","example":"2026-02-12T20:00:00Z"}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and it's status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/thermostat/set-operating-mode/batch":{"post":{"description":"Send set-operating-mode batch command to a group of thermostats.","summary":"Send set-operating-mode batch command to a group of thermostats.","tags":["Batch Commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tag":{"type":"string","description":"The tag for the group of thermostats to target.","example":"my-thermostat-tag"},"input":{"anyOf":[{"type":"object","properties":{"operatingMode":{"type":"string","enum":["off"],"description":"Sets the thermostat operating mode to off."}},"required":["operatingMode"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["heat"],"description":"Sets the thermostat operating mode to heat."},"heatTarget":{"type":"number","description":"The target temperature for heating in degrees Fahrenheit. Required for operating modes `heat`, `auto`, and `eco`."}},"required":["operatingMode","heatTarget"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["cool"],"description":"Sets the thermostat operating mode to cool."},"coolTarget":{"type":"number","description":"The target temperature for cooling in degrees Fahrenheit. Required for operating modes `cool`, `auto`, and `eco`."}},"required":["operatingMode","coolTarget"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["auto"],"description":"Sets the thermostat operating mode to auto."},"heatTarget":{"type":"number","description":"The target temperature for heating in degrees Fahrenheit. Required for operating modes `heat`, `auto`, and `eco`."},"coolTarget":{"type":"number","description":"The target temperature for cooling in degrees Fahrenheit. Required for operating modes `cool`, `auto`, and `eco`."}},"required":["operatingMode","heatTarget","coolTarget"]},{"type":"object","properties":{"operatingMode":{"type":"string","enum":["eco"],"description":"Sets the thermostat operating mode to eco."},"heatTarget":{"type":"number","description":"The target temperature for heating in degrees Fahrenheit. Required for operating modes `heat`, `auto`, and `eco`."},"coolTarget":{"type":"number","description":"The target temperature for cooling in degrees Fahrenheit. Required for operating modes `cool`, `auto`, and `eco`."}},"required":["operatingMode","heatTarget","coolTarget"]}],"description":"The expected payload of the thermostat:set-operating-mode command."}},"required":["tag","input"]}}}},"responses":{"202":{"description":"The list of commands that were sent to the group or batch of devices","content":{"application/json":{"schema":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/Command"},{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}]}}}}},"400":{"description":"There was an issue sending the batch command.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/vehicle/set-charge-limit":{"post":{"description":"Send set-charge-limit command to a vehicle.","summary":"Send set-charge-limit command to a vehicle.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"type":"object","properties":{"chargeLimit":{"type":"integer","minimum":0,"maximum":100,"description":"The desired charge limit of the vehicle (in percent, from 0 up to 100)."},"requireHomeLocation":{"type":"boolean","default":false,"description":"When true, command only executes if vehicle is at its home location. Defaults to false."},"homeRadiusMeters":{"type":"number","exclusiveMinimum":0,"default":250,"description":"Radius in meters for home location check. Only used when requireHomeLocation is true. Defaults to 250."}},"required":["chargeLimit"],"description":"The expected payload of the vehicle:set-charge-limit command."},"startAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the start of the override detection window. The command executes immediately regardless of this value. If omitted, monitoring begins at command completion.","example":"2026-02-12T18:00:00Z"},"endAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the end of the override detection window. When set, the system monitors the device for manual overrides until this time and emits a command.overridden webhook event if the device state diverges. This does not schedule the command — execution is immediate.","example":"2026-02-12T20:00:00Z"}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and its status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"},"example":{"id":"cllgn0u4r000008l7eazybfbo","status":"pending","reason":"","type":"vehicle:set-charge-limit","issuedAt":"2019-08-24T14:15:22Z","executedAt":null,"input":{"chargeLimit":80,"requireHomeLocation":false,"homeRadiusMeters":250}}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/vehicle/set-operating-mode":{"post":{"description":"Send set-operating-mode command to a vehicle.","summary":"Send set-operating-mode command to a vehicle.","tags":["commands"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture to send the command.","example":"clmv27bxa000b6jx0qdv3atp6"},"input":{"type":"object","properties":{"operatingMode":{"type":"string","enum":["start-charging","stop-charging"],"description":"The desired operating mode or charging state of the vehicle."},"requireHomeLocation":{"type":"boolean","default":false,"description":"When true, command only executes if vehicle is at its home location. Defaults to false."},"homeRadiusMeters":{"type":"number","exclusiveMinimum":0,"default":250,"description":"Radius in meters for home location check. Only used when requireHomeLocation is true. Defaults to 250."}},"required":["operatingMode"],"description":"The expected payload of the vehicle:set-operating-mode command."},"startAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the start of the override detection window. The command executes immediately regardless of this value. If omitted, monitoring begins at command completion.","example":"2026-02-12T18:00:00Z"},"endAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 datetime marking the end of the override detection window. When set, the system monitors the device for manual overrides until this time and emits a command.overridden webhook event if the device state diverges. This does not schedule the command — execution is immediate.","example":"2026-02-12T20:00:00Z"}},"required":["deviceId","input"]}}}},"responses":{"201":{"description":"The command that was sent to the device and its status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"},"example":{"id":"cllgn0u4r000008l7eazybfbo","status":"pending","reason":"","type":"vehicle:set-operating-mode","issuedAt":"2019-08-24T14:15:22Z","executedAt":null,"input":{"operatingMode":"start-charging","requireHomeLocation":false,"homeRadiusMeters":250}}}}},"400":{"description":"There was an issue sending the command to the device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/commands/{id}":{"get":{"description":"Get command data by its ID.","summary":"Get a single command","tags":["commands"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the command issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the command issued by Texture.","name":"id","in":"path"}],"responses":{"200":{"description":"Object with command data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Command"}}}}}},"delete":{"description":"Delete a command by ID. This endpoint is not currently implemented.","summary":"Delete command","tags":["Commands"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier of the command","example":"cllgn0u4r000008l7eazybfb2"},"required":true,"description":"The unique identifier of the command","name":"id","in":"path"}],"responses":{"501":{"description":"Not implemented","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message","example":"Not implemented"}},"required":["message"]}}}}}}},"/customers":{"get":{"description":"Fetches Customers for a Workspace by Workspace ID","summary":"Fetches Customers for a Workspace by Workspace ID","tags":["customers"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."},{"schema":{"type":"string","description":"The reference ID of the customer to filter by.","example":"01234567"},"required":false,"description":"The reference ID of the customer to filter by.","name":"referenceId","in":"query"}],"responses":{"200":{"description":"The organization details.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]}}}},"502":{"description":"Failed to fetch customers from upstream","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Failed to fetch customers from upstream"]}},"required":["message"]}}}}}},"post":{"description":"Create a new customer within the workspace associated with the API key.","summary":"Create Customer","tags":["customers"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"referenceId":{"type":"string","description":"An external ID to link the Customer to an external system"},"firstName":{"type":"string","description":"Customer's first name"},"lastName":{"type":"string","description":"Customer's last name"},"email":{"type":"string","format":"email","description":"Customer's email address"},"phone":{"type":"string","description":"Customer's phone number"}},"required":["referenceId"]}}}},"responses":{"201":{"description":"The customer that was successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"Bad Request - Invalid input data.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error - Error creating customer.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}},"/customers/{id}":{"get":{"description":"Fetches a Customer and that Customer's associated by the Customer ID","summary":"Fetches a Customer by ID","tags":["customers"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The ID of the customer to fetch.","example":"cjoq4z9zv0000kz6z1z1z1z1z"},"required":true,"description":"The ID of the customer to fetch.","name":"id","in":"path"}],"responses":{"200":{"description":"The organization details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}}}},"delete":{"description":"Delete a single Customer by its ID.","summary":"Delete a single Customer by its ID","tags":["customers"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"responses":{"204":{"description":"Customer deleted","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Customer deleted"]}},"required":["message"]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Resource not found"]}},"required":["message"]}}}},"500":{"description":"Server failure","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Server failure"]}},"required":["message"]}}}}}}},"/customers/{id}/sites":{"get":{"description":"Fetches a Customer's Sites by Customer ID","summary":"Fetches a Customer's Sites by Customer ID","tags":["customers"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The ID of the customer who's sites we are fetching.","example":"cjoq4z9zv0000kz6z1z1z1z1z"},"required":true,"description":"The ID of the customer who's sites we are fetching.","name":"id","in":"path"}],"responses":{"200":{"description":"The organization details.","content":{"application/json":{"schema":{"type":"object","properties":{"sites":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the Site issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"name":{"type":["string","null"],"description":"The name of the Site."},"referenceId":{"type":["string","null"],"description":"The reference ID of the Site.","example":"9bb290c8-fe97-46ce-92a8-952823164277"},"workspaceId":{"type":"string","format":"cuid","description":"The unique identifier for the Workspace to which the Site belongs, issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"createdAt":{"type":["string","null"],"format":"date-time","description":"The date and time that this Site was created.","example":"2024-04-01T00:00:00.000Z"},"updatedAt":{"type":["string","null"],"format":"date-time","description":"The date and time that this Site was last updated.","example":"2024-04-01T00:00:00.000Z"},"connectedCustomers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the customer issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"workspaceId":{"type":"string","format":"cuid","description":"The unique identifier for the workspace issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"referenceId":{"type":["string","null"],"description":"The reference ID for the customer.","example":"01234567"},"firstName":{"type":["string","null"],"description":"The given name of the customer.","example":"John"},"lastName":{"type":["string","null"],"description":"The surname of the customer.","example":"Smith"},"email":{"type":["string","null"],"format":"email","description":"The email address of the customer.","example":"test@example.com"},"phone":{"type":["string","null"],"description":"The phone number of the customer as provided during creation or update.","example":"1234567890"},"devices":{"type":"array","items":{"$ref":"#/components/schemas/Device"},"description":"The devices connected to the customer."},"createdAt":{"type":["string","null"],"format":"date-time","description":"The date and time the customer was created in the system.","example":"2026-03-12T21:15:16.073Z"},"updatedAt":{"type":["string","null"],"format":"date-time","description":"The date and time the customer was last updated in the system.","example":"2026-03-12T21:15:16.073Z"}},"required":["id","workspaceId","referenceId","createdAt"]}},"location":{"type":"object","properties":{"streetOne":{"type":["string","null"],"description":"The first line of the address.","example":"123 Main St"},"streetTwo":{"type":["string","null"],"description":"The second line of the address.","example":"Apt 101"},"city":{"type":["string","null"],"description":"The city of the site.","example":"San Francisco"},"state":{"type":["string","null"],"description":"The state of the site.","example":"CA"},"postalCode":{"type":["string","null"],"description":"The postal code of the site.","example":"94105"},"country":{"type":["string","null"],"description":"The country of the site.","example":"USA"},"latitude":{"type":"number","description":"The latitude of the site.","example":37.7749},"longitude":{"type":"number","description":"The longitude of the site.","example":-122.4194}},"required":["latitude","longitude"]},"energyUsage":{"type":["array","null"],"items":{"type":"object","properties":{"startDate":{"type":"string","format":"date-time","description":"The start date and time of the energy usage period.","example":"2024-04-01T00:00:00.000Z"},"endDate":{"type":"string","format":"date-time","description":"The end date and time of the energy usage period.","example":"2024-04-01T00:00:00.000Z"},"consumption":{"type":"number","description":"Total energy consumed at the Site during the period.","example":100},"price":{"type":"number","description":"The price of the energy consumed during the period.","example":0.1},"emissions":{"type":"number","description":"The amount of emissions produced during the period.","example":0.1},"cost":{"type":"object","properties":{"amount":{"type":"integer","description":"The integer representation of the cost of the energy consumed during the period.","example":10},"currencyCode":{"type":"string","description":"The currency code of the cost.","example":"USD"},"formatted":{"type":"string","description":"The formatted cost of the energy consumed during the period.","example":"$10.00"}},"required":["amount","currencyCode","formatted"]}},"required":["startDate","endDate","consumption"]}},"utility":{"type":"object","properties":{"name":{"type":"string","description":"The name of the utility provider.","example":"Pacifc Gas and Electric"}},"required":["name"],"description":"The utility for the Site."},"wholesaleMarket":{"type":"object","properties":{"name":{"type":"string","description":"The name of the wholesale market.","example":"California Independent Systems Operator"}},"required":["name"],"description":"The wholesale market for the Site."},"weather":{"$ref":"#/components/schemas/WeatherData"},"permits":{"type":"array","items":{"$ref":"#/components/schemas/Permit"},"description":"The list of permits associated with the Site. Only available for workspaces with an enabled permits integration."},"energyModeling":{"$ref":"#/components/schemas/EnergyModelingData"},"intervals":{"type":"array","items":{"$ref":"#/components/schemas/Interval"},"description":"The list of intervals associated with the Site."}},"required":["id","workspaceId","createdAt","location"]}}},"required":["sites"]}}}},"404":{"description":"Customer not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Customer not found"]}},"required":["message"]}}}},"502":{"description":"Failed to fetch customer sites from upstream","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Failed to fetch customer sites from upstream"]}},"required":["message"]}}}}}}},"/devices":{"post":{"description":"Create a new OEM-provisioned device. Requires a MANUFACTURER API key. Returns 201 for newly created devices, 200 for existing devices with matching parameters (idempotent), or 409 if a device exists with the same manufacturerDeviceId but different parameters.","summary":"Create OEM Device","tags":["OEM Direct Integration"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"manufacturerDeviceId":{"type":"string","minLength":1},"deviceModelId":{"type":"string","minLength":1},"siteId":{"type":"string","minLength":1},"serialNumber":{"type":"string"},"name":{"type":"string"}},"required":["manufacturerDeviceId","deviceModelId","siteId"]}}}},"responses":{"200":{"description":"An existing device with matching parameters was found (idempotent).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"manufacturerDeviceId":{"type":"string"},"deviceModelId":{"type":["string","null"]},"siteId":{"type":["string","null"]},"provisioningType":{"type":"string","enum":["TEXTURE_MANAGED","OEM_DIRECT"]},"serialNumber":{"type":["string","null"]},"name":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","manufacturerDeviceId","deviceModelId","siteId","provisioningType","serialNumber","name","createdAt"]}}}},"201":{"description":"The device that was successfully created.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"manufacturerDeviceId":{"type":"string"},"deviceModelId":{"type":["string","null"]},"siteId":{"type":["string","null"]},"provisioningType":{"type":"string","enum":["TEXTURE_MANAGED","OEM_DIRECT"]},"serialNumber":{"type":["string","null"]},"name":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","manufacturerDeviceId","deviceModelId","siteId","provisioningType","serialNumber","name","createdAt"]}}}},"400":{"description":"Bad Request - Invalid input data, device model not found, or site not found.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - Invalid or missing MANUFACTURER API key.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden - Device model does not belong to manufacturers in API key scope.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"409":{"description":"Conflict - A device with this manufacturerDeviceId exists but with different parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","enum":["PARAMETER_MISMATCH"]},"mismatchedFields":{"type":"array","items":{"type":"string"}}},"required":["message","code","mismatchedFields"]}}}},"500":{"description":"Internal Server Error - Error creating device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}},"get":{"description":"Get all devices for a workspace with additional optional filtering.","summary":"Get a list of devices","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"in":"query","name":"referenceId","description":"The reference ID to filter devices by.","example":"9bb290c8-fe97-46ce-92a8-952823164277"},{"schema":{"type":"string"},"required":false,"in":"query","name":"manufacturer","description":"The manufacturer to filter devices by."},{"schema":{"type":"string"},"required":false,"in":"query","name":"manufacturerDeviceId","description":"The manufacturer device ID to filter devices by.","example":"b1143000-69ac-481f-9bef-4bfd96198133"},{"schema":{"type":"string"},"required":false,"in":"query","name":"type","description":"The device type to filter devices by."},{"schema":{"type":"string"},"required":false,"in":"query","name":"model","description":"The device model to filter devices by."},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Object with device data and pagination info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevicesResponse"}}}}}}},"/devices/{id}/telemetry":{"post":{"description":"Push telemetry data for an OEM-provisioned device. Requires a MANUFACTURER API key. The device must have provisioningType OEM_DIRECT and belong to a manufacturer in the API key scope.","summary":"Push Device Telemetry","tags":["OEM Direct Integration"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the device","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","description":"The timestamp for the telemetry reading. Defaults to current time if not provided.","example":"2024-01-15T10:32:15Z"},"state":{"type":"object","additionalProperties":{},"description":"Device state data. Schema varies by device type.","example":{"chargePercentage":85,"charge":15725,"chargeRate":2400,"chargingState":"charging","backupReserve":20}}},"required":["state"]}}}},"responses":{"202":{"description":"Telemetry accepted for processing.","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean","enum":[true]},"deviceId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}},"required":["accepted","deviceId","timestamp"]}}}},"400":{"description":"Bad Request - Telemetry validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"error":{"type":"string"},"value":{}},"required":["field","error"]}}},"required":["error","message"]}}}},"401":{"description":"Unauthorized - Invalid or missing MANUFACTURER API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"error":{"type":"string"},"value":{}},"required":["field","error"]}}},"required":["error","message"]}}}},"403":{"description":"Forbidden - Device is not OEM_DIRECT or does not belong to manufacturers in API key scope.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"error":{"type":"string"},"value":{}},"required":["field","error"]}}},"required":["error","message"]}}}},"404":{"description":"Not Found - Device not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"error":{"type":"string"},"value":{}},"required":["field","error"]}}},"required":["error","message"]}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"error":{"type":"string"},"value":{}},"required":["field","error"]}}},"required":["error","message"]}}}}}}},"/devices/types":{"get":{"description":"List the device types supported by the Texture API","summary":"Get a list of device types","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"List of device types","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceTypes"}}}}}}},"/devices/{id}/history":{"get":{"description":"Get all archived state data for a single device","summary":"Get historical data for a device state","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"in":"query","name":"from","description":"The date and time from which to return device state historical data.","example":"2023-09-10T11:43:33.266Z"},{"schema":{"type":"string"},"required":false,"in":"query","name":"to","description":"The date and time to which to return device state historical data.","example":"2023-09-21T11:43:33.266Z"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Device historical state data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceHistoryResponse"}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided"]}},"required":["message"]}}}},"401":{"description":"Invalid authentication","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid authentication"]}},"required":["message"]}}}}}}},"/devices/{id}/commands":{"get":{"description":"Get paginated commands for a single device","summary":"Get commands data for a device","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"},{"schema":{"type":"array","items":{"type":"string","enum":["pending","completed","scheduled","failed"],"description":"The current status of the command.","example":"pending"},"example":["pending","completed","scheduled","failed"]},"required":false,"in":"query","name":"status","description":"Array of command statuses to filter by. If not provided, all commands will be returned."},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Device commands data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceCommandsResponse"}}}}}}},"/devices/{id}/alerts":{"get":{"description":"Get a list of alerts for a device","summary":"Get all alerts for a device with additional optional filtering","tags":["alerts","devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"The device ID to get alerts for","example":"cllgn0u4r000008l7eazybfbo"},{"schema":{"type":"string"},"required":false,"in":"query","name":"externalId","description":"Filter alerts by external ID.","example":"124254116"},{"schema":{"type":"string","enum":["CRITICAL","WARNING","INFO"],"description":"The severity level of the alert.","example":"WARNING"},"required":false,"description":"Filter alerts by severity level.","in":"query","name":"severity"},{"schema":{"type":"string","enum":["OPEN","ACKNOWLEDGED","IGNORED","RESOLVED"],"description":"The current status of the alert.","example":"OPEN"},"required":false,"description":"Filter alerts by status.","in":"query","name":"status"},{"schema":{"type":"string"},"required":false,"in":"query","name":"siteId","description":"Filter alerts by site ID.","example":"cllgn0u4r000008l7eazybfbo"},{"schema":{"type":"string"},"required":false,"in":"query","name":"sourceSystem","description":"Filter alerts by source system.","example":"Inverter 01"},{"schema":{"type":"string"},"required":false,"in":"query","name":"manufacturerDeviceId","description":"Filter alerts by manufacturer device ID.","example":"123456"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Object with alerts data and pagination info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alerts"}}}},"401":{"description":"Unauthorized - Missing or invalid API key"},"403":{"description":"Forbidden - Access denied"},"404":{"description":"Not found"}}}},"/devices/{id}/tags":{"get":{"description":"Get tags associated with a device.","summary":"Get device tags","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"responses":{"200":{"description":"Array of tags associated with the device.","content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"},"description":"The tags associated with the device.","example":["tag1","tag2"]}},"required":["tags"]}}}},"403":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}},"404":{"description":"Device not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}}}},"put":{"description":"Update tags associated with a device.","summary":"Update device tags","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"},"description":"The tags to update for the device.","example":["tag1","tag2"]}},"required":["tags"]}}}},"responses":{"200":{"description":"Updated array of tags associated with the device.","content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"},"description":"The updated tags associated with the device.","example":["tag1","tag2"]}},"required":["tags"]}}}},"403":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}},"404":{"description":"Device not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}}}}},"/devices/{id}/site":{"put":{"description":"Update the site associated with a device. Sets the siteProfileId on the device, linking it to a specific site within the workspace.","summary":"Update device site","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"siteProfileId":{"type":"string","description":"The ID of the site to associate this device with.","example":"cmg8kxvmq0a676l5domv8g5of"}},"required":["siteProfileId"]}}}},"responses":{"200":{"description":"The device with updated site association.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the device.","example":"clmt0f0qq000g6jez6qa2sj4t"},"siteProfileId":{"type":["string","null"],"description":"The ID of the site this device is associated with.","example":"cmg8kxvmq0a676l5domv8g5of"}},"required":["id","siteProfileId"]}}}},"403":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}},"404":{"description":"Device not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"The error message.","example":"Device not found"}},"required":["message"]}}}}}}},"/devices/{id}":{"get":{"description":"Get device data by its ID.","summary":"Get a single device","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"responses":{"200":{"description":"Object with device data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Device"}}}},"404":{"description":"Device not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Device not found"]}},"required":["message"]}}}}}},"delete":{"description":"Delete device by its ID.","summary":"Delete a single device","tags":["devices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"clmt0f0qq000g6jez6qa2sj4t"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"responses":{"204":{"description":"Device deleted","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Device deleted"]}},"required":["message"]}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided"]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided"]}},"required":["message"]}}}},"403":{"description":"Unauthorized action","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Unauthorized action"]}},"required":["message"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Resource not found"]}},"required":["message"]}}}},"500":{"description":"Server failure","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Server failure"]}},"required":["message"]}}}}}}},"/devices/{id}/schedules":{"get":{"description":"Looks up the schedules related to a device.","summary":"Get a device's schedules","tags":["schedules","devices"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"responses":{"200":{"description":"The given device schedule.","content":{"application/json":{"schema":{"type":"object","properties":{"deviceSchedules":{"type":"array","items":{"$ref":"#/components/schemas/DeviceSchedule"}}},"required":["deviceSchedules"]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}},"delete":{"description":"Deletes all of a device's schedules (if any exist) and returns the deleted schedule info.","summary":"Deletes a device's schedules","tags":["schedules","devices"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"responses":{"200":{"description":"The schedule(s) that was deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deviceSchedules":{"type":"array","items":{"$ref":"#/components/schemas/DeviceSchedule"}}},"required":["deviceSchedules"]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}}},"/devices/{id}/schedule/{scheduleId}":{"get":{"description":"Looks up a schedule related to a device.","summary":"Get a device schedule","tags":["schedules","devices"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"},{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the schedule issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the schedule issued by Texture.","name":"scheduleId","in":"path"}],"responses":{"200":{"description":"The given device schedule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSchedule"}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}},"404":{"description":"Schedule not found for device.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Schedule not found for device."]}},"required":["message"]}}}}}},"delete":{"description":"Deletes a device's schedule by id.","summary":"Delete a device schedule","tags":["schedules","devices"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"},{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the schedule issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the schedule issued by Texture.","name":"scheduleId","in":"path"}],"responses":{"200":{"description":"The schedule that was deleted.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/DeviceSchedule"},{"type":["object","null"]}]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}}},"/devices/{id}/schedule":{"post":{"description":"Create a new device schedule.","summary":"Create new device schedule","tags":["schedules","devices"],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the device issued by Texture.","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"schedule":{"type":"object","properties":{"deviceTimezone":{"type":"string","description":"A valid timezone string","example":"America/New_York"},"startsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule starts.","example":"2021-04-01T00:00:00.000Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule ends.","example":"2021-04-01T00:00:00.000Z"},"defaultDeviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}}},"required":["defaultDeviceOperatingMode"]},"rules":{"type":"array","items":{"type":"object","properties":{"daysOfWeek":{"type":"array","items":{"type":"integer"},"example":[0,1,2,3,4,5,6],"description":"The days of the week the rule is active, numbered 0-6, where 0 is Sunday. In the example the rule is active every day of the week."},"startTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"endTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"deviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}}},"required":["daysOfWeek","startTime","endTime","deviceOperatingMode"]}},"force":{"type":"boolean","description":"If true, the device schedule will be set even if it overlaps with an existing schedule. The overlapping schedule will be deleted. If false, we will throw an error if the schedule overlap. You need to delete the existing schedule manually before creating a new one.","example":false}},"required":["schedule","rules"]}}}},"responses":{"200":{"description":"The newly created device schedule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSchedule"}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}}},"/enrollments/{enrollmentId}":{"get":{"description":"Get details of a specific enrollment.","summary":"Get enrollment by ID","tags":["enrollments"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"in":"path","name":"enrollmentId","description":"The unique identifier of the enrollment to retrieve"}],"responses":{"200":{"description":"Enrollment details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Enrollment"}}}},"404":{"description":"Enrollment not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"description":"Delete an enrollment by ID. This operation sets the enrollment status to 'unenrolling'.","summary":"Delete enrollment","tags":["enrollments"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The unique identifier of the enrollment to delete","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier of the enrollment to delete","name":"enrollmentId","in":"path"}],"responses":{"204":{"description":"Enrollment successfully deleted (status set to unenrolling)"},"400":{"description":"Invalid request"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Enrollment not found"},"500":{"description":"Internal server error"}}}},"/enrollments/{enrollmentId}/metadata":{"patch":{"description":"Update enrollment metadata using merge semantics. Provided keys will be added or updated, while existing keys not mentioned will remain unchanged. This operation does not replace the entire metadata object.","summary":"Update enrollment metadata (merge)","tags":["enrollments"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"in":"path","name":"enrollmentId","description":"The unique identifier of the enrollment"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"Metadata key-value pairs to merge with existing enrollment metadata. Keys will be added or updated; existing keys not mentioned will remain unchanged.","example":{"source":"api","campaign":"summer2026","partner_id":"ABC123"}}},"required":["metadata"]}}}},"responses":{"200":{"description":"Enrollment metadata updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Enrollment"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"Forbidden - not authorized to update this enrollment","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"Enrollment not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/enrollments/{enrollmentId}/status":{"put":{"description":"Update the eligibility status of a specific enrollment. Valid statuses: candidate, eligible, ineligible, submitted, approved, rejected, unenrolling.","summary":"Update enrollment status","tags":["enrollments"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"in":"path","name":"enrollmentId","description":"The unique identifier of the enrollment to update"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["candidate","eligible","ineligible","submitted","approved","rejected","unenrolling"],"description":"The new eligibility status for the enrollment","example":"eligible"}},"required":["status"]}}}},"responses":{"200":{"description":"Enrollment status updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Enrollment"}}}},"400":{"description":"Invalid status value","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"Enrollment not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/leads":{"get":{"description":"Get a list of leads for a workspace","summary":"Get a list of leads","tags":["leads"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Object with lead data and pagination info","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"cuid"},"email":{"type":"string","format":"email"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"address1":{"type":["string","null"]},"address2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"country":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","email","firstName","lastName","phone","address1","address2","city","state","postalCode","country","metadata","createdAt","updatedAt"]}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]}}}},"401":{"description":"Unauthorized - Invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"]}}}}}},"post":{"description":"Create a new lead","summary":"Create a new lead","tags":["leads"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"address1":{"type":["string","null"]},"address2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"country":{"type":["string","null"]},"metadata":{"type":["object","null"],"additionalProperties":{"type":"string"}}},"required":["email"]}}}},"responses":{"200":{"description":"The lead that was created.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"cuid"},"email":{"type":"string","format":"email"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"phone":{"type":["string","null"]},"address1":{"type":["string","null"]},"address2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"country":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","email","firstName","lastName","phone","address1","address2","city","state","postalCode","country","metadata","createdAt","updatedAt"]}}}},"500":{"description":"Error from creating lead.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}},"/metrics/consumption":{"get":{"description":"Metric detailing the total energy consumed in watt hours for each time bucket. Applicable to battery devices.","summary":"Get energy consumption metrics","tags":["metrics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"array","items":{"type":"string"},"description":"Device IDs to fetch metrics for","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Device IDs to fetch metrics for","name":"filterDeviceId","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Site IDs to fetch metrics for if grouped by site","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Site IDs to fetch metrics for if grouped by site","name":"filterSiteId","in":"query"},{"schema":{"type":"string","pattern":"^([1-9]\\d{0,1}[hwdmMy])$","description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","example":"24h"},"required":false,"description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","name":"filterRangeRelative","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range start point which to fetch metrics","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range start point which to fetch metrics","name":"filterRangeAfter","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","name":"filterRangeBefore","in":"query"},{"schema":{"type":"string","enum":["FIFTEEN_MINUTES","HOUR","DAY","WEEK","MONTH","YEAR"],"description":"Size of the window to fetch metrics for","example":"HOUR"},"required":false,"description":"Size of the window to fetch metrics for","name":"windowSize","in":"query"},{"schema":{"type":"string","enum":["SITE"],"description":"Facet to group the metrics by (e.g. site)","example":"SITE"},"required":false,"description":"Facet to group the metrics by (e.g. site)","name":"groupBy","in":"query"}],"responses":{"200":{"description":"Object with energy consumption metrics","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"ts":{"type":["string","null"],"format":"date-time","description":"Timestamp of the data point","example":"2021-01-01T00:00:00Z"},"v":{"type":"number","description":"Total energy consumed in watt hours for the time bucket","example":100},"deviceId":{"type":["string","null"],"description":"Device ID for the data point","example":"clmt0f0qq000g6jez6qa2sj4t"},"siteId":{"type":["string","null"]},"customerId":{"type":["string","null"]}},"required":["ts","v"]}},"meta":{"type":"object","properties":{"label":{"type":"string","description":"Label for the metric","example":"energyConsumedWhr"},"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"],"description":"Unit of the metric","example":"WATT_HOURS"},"displayUnit":{"type":"string","description":"Display unit of the metric","example":"whr"},"sparse":{"type":"boolean","description":"Whether the metric is sparse","example":false},"series":{"type":["array","null"],"items":{"type":"string"},"description":"Series for the metric","example":["clmt0f0qq000g6jez6qa2sj4t"]},"domainMeta":{"type":"object","properties":{"label":{"type":"string"},"sparse":{"type":"boolean"},"rate":{"type":"object","properties":{"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"]},"displayUnit":{"type":"string"},"scaleFactor":{"type":"number"}},"required":["unit","displayUnit","scaleFactor"]}},"required":["label","sparse","rate"],"description":"Domain metadata for the metric"}},"required":["label","unit","displayUnit","sparse","domainMeta"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Invalid parameters provided.","details":{"error":"filterRangeRelative: Relative time must be in the format Nh, Nd, Nw, Nm, Ny"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Internal server error."}}}}}}}},"/metrics/production":{"get":{"description":"Metric detailing the total energy produced/discharged in watt hours for each time bucket. Applicable to battery devices.","summary":"Get energy production metrics","tags":["metrics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"array","items":{"type":"string"},"description":"Device IDs to fetch metrics for","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Device IDs to fetch metrics for","name":"filterDeviceId","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Site IDs to fetch metrics for if grouped by site","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Site IDs to fetch metrics for if grouped by site","name":"filterSiteId","in":"query"},{"schema":{"type":"string","pattern":"^([1-9]\\d{0,1}[hwdmMy])$","description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","example":"24h"},"required":false,"description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","name":"filterRangeRelative","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range start point which to fetch metrics","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range start point which to fetch metrics","name":"filterRangeAfter","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","name":"filterRangeBefore","in":"query"},{"schema":{"type":"string","enum":["FIFTEEN_MINUTES","HOUR","DAY","WEEK","MONTH","YEAR"],"description":"Size of the window to fetch metrics for","example":"HOUR"},"required":false,"description":"Size of the window to fetch metrics for","name":"windowSize","in":"query"},{"schema":{"type":"string","enum":["SITE"],"description":"Facet to group the metrics by (e.g. site)","example":"SITE"},"required":false,"description":"Facet to group the metrics by (e.g. site)","name":"groupBy","in":"query"}],"responses":{"200":{"description":"Object with energy production metrics","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"ts":{"type":["string","null"],"format":"date-time","description":"Timestamp of the data point","example":"2021-01-01T00:00:00Z"},"v":{"type":"number","description":"Total energy produced/discharged in watt hours for the time bucket","example":100},"deviceId":{"type":["string","null"],"description":"Device ID for the data point","example":"clmt0f0qq000g6jez6qa2sj4t"},"siteId":{"type":["string","null"]},"customerId":{"type":["string","null"]}},"required":["ts","v"]}},"meta":{"type":"object","properties":{"label":{"type":"string","description":"Label for the metric","example":"energyProducedWhr"},"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"],"description":"Unit of the metric","example":"WATT_HOURS"},"displayUnit":{"type":"string","description":"Display unit of the metric","example":"whr"},"sparse":{"type":"boolean","description":"Whether the metric is sparse","example":false},"series":{"type":["array","null"],"items":{"type":"string"},"description":"Series for the metric","example":["clmt0f0qq000g6jez6qa2sj4t"]},"domainMeta":{"type":"object","properties":{"label":{"type":"string"},"sparse":{"type":"boolean"},"rate":{"type":"object","properties":{"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"]},"displayUnit":{"type":"string"},"scaleFactor":{"type":"number"}},"required":["unit","displayUnit","scaleFactor"]}},"required":["label","sparse","rate"],"description":"Domain metadata for the metric"}},"required":["label","unit","displayUnit","sparse","domainMeta"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Invalid parameters provided.","details":{"error":"filterRangeAfter: Start time must be in the past"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Internal server error."}}}}}}}},"/metrics/storage":{"get":{"description":"Metric detailing the latest energy stored in watt hours for each time bucket. Applicable to battery devices.","summary":"Get energy storage metrics","tags":["metrics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"array","items":{"type":"string"},"description":"Device IDs to fetch metrics for","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Device IDs to fetch metrics for","name":"filterDeviceId","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Site IDs to fetch metrics for if grouped by site","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Site IDs to fetch metrics for if grouped by site","name":"filterSiteId","in":"query"},{"schema":{"type":"string","pattern":"^([1-9]\\d{0,1}[hwdmMy])$","description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","example":"24h"},"required":false,"description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","name":"filterRangeRelative","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range start point which to fetch metrics","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range start point which to fetch metrics","name":"filterRangeAfter","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","name":"filterRangeBefore","in":"query"},{"schema":{"type":"string","enum":["FIFTEEN_MINUTES","HOUR","DAY","WEEK","MONTH","YEAR"],"description":"Size of the window to fetch metrics for","example":"HOUR"},"required":false,"description":"Size of the window to fetch metrics for","name":"windowSize","in":"query"},{"schema":{"type":"string","enum":["SITE"],"description":"Facet to group the metrics by (e.g. site)","example":"SITE"},"required":false,"description":"Facet to group the metrics by (e.g. site)","name":"groupBy","in":"query"}],"responses":{"200":{"description":"Object with energy storage metrics","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"ts":{"type":["string","null"],"format":"date-time","description":"Timestamp of the data point","example":"2021-01-01T00:00:00Z"},"v":{"type":"number","description":"Latest energy stored in watt hours for the time bucket","example":100},"deviceId":{"type":["string","null"],"description":"Device ID for the data point","example":"clmt0f0qq000g6jez6qa2sj4t"},"siteId":{"type":["string","null"]},"customerId":{"type":["string","null"]}},"required":["ts","v"]}},"meta":{"type":"object","properties":{"label":{"type":"string","description":"Label for the metric","example":"charge"},"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"],"description":"Unit of the metric","example":"WATT_HOURS"},"displayUnit":{"type":"string","description":"Display unit of the metric","example":"whr"},"sparse":{"type":"boolean","description":"Whether the metric is sparse","example":false},"series":{"type":["array","null"],"items":{"type":"string"},"description":"Series for the metric","example":["clmt0f0qq000g6jez6qa2sj4t"]},"domainMeta":{"type":"object","properties":{"label":{"type":"string"},"sparse":{"type":"boolean"},"rate":{"type":"object","properties":{"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"]},"displayUnit":{"type":"string"},"scaleFactor":{"type":"number"}},"required":["unit","displayUnit","scaleFactor"]}},"required":["label","sparse","rate"],"description":"Domain metadata for the metric"}},"required":["label","unit","displayUnit","sparse","domainMeta"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"]}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Internal server error."}}}}}}}},"/metrics/emissions":{"get":{"description":"Metric detailing the total energy emissions in pounds of CO2 for each time bucket.","summary":"Get energy emissions metrics","tags":["metrics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"array","items":{"type":"string"},"description":"Device IDs to fetch metrics for","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Device IDs to fetch metrics for","name":"filterDeviceId","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Site IDs to fetch metrics for if grouped by site","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Site IDs to fetch metrics for if grouped by site","name":"filterSiteId","in":"query"},{"schema":{"type":"string","pattern":"^([1-9]\\d{0,1}[hwdmMy])$","description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","example":"24h"},"required":false,"description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","name":"filterRangeRelative","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range start point which to fetch metrics","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range start point which to fetch metrics","name":"filterRangeAfter","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","name":"filterRangeBefore","in":"query"},{"schema":{"type":"string","enum":["FIFTEEN_MINUTES","HOUR","DAY","WEEK","MONTH","YEAR"],"description":"Size of the window to fetch metrics for","example":"HOUR"},"required":false,"description":"Size of the window to fetch metrics for","name":"windowSize","in":"query"},{"schema":{"type":"string","enum":["SITE"],"description":"Facet to group the metrics by (e.g. site)","example":"SITE"},"required":false,"description":"Facet to group the metrics by (e.g. site)","name":"groupBy","in":"query"}],"responses":{"200":{"description":"Object with energy emissions metrics","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"ts":{"type":["string","null"],"format":"date-time","description":"Timestamp of the data point","example":"2021-01-01T00:00:00Z"},"v":{"type":"number","description":"Total energy emissions in pounds of CO2 for the time bucket","example":100},"deviceId":{"type":["string","null"],"description":"Device ID for the data point","example":"clmt0f0qq000g6jez6qa2sj4t"},"siteId":{"type":["string","null"]},"customerId":{"type":["string","null"]}},"required":["ts","v"]}},"meta":{"type":"object","properties":{"label":{"type":"string","description":"Label for the metric","example":"energyEmissions"},"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"],"description":"Unit of the metric","example":"POUNDS_CO2"},"displayUnit":{"type":"string","description":"Display unit of the metric","example":"lbs_co2"},"sparse":{"type":"boolean","description":"Whether the metric is sparse","example":false},"series":{"type":["array","null"],"items":{"type":"string"},"description":"Series for the metric","example":["clmt0f0qq000g6jez6qa2sj4t"]},"domainMeta":{"type":"object","properties":{"label":{"type":"string"},"sparse":{"type":"boolean"},"rate":{"type":"object","properties":{"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"]},"displayUnit":{"type":"string"},"scaleFactor":{"type":"number"}},"required":["unit","displayUnit","scaleFactor"]}},"required":["label","sparse","rate"],"description":"Domain metadata for the metric"}},"required":["label","unit","displayUnit","sparse","domainMeta"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Invalid parameters provided.","details":{"error":"At least one deviceId must be specified if grouping by device"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Internal server error."}}}}}}}},"/metrics/generation":{"get":{"description":"Metric detailing the total energy generated in watt hours for each time bucket. Applicable to inverter devices.","summary":"Get energy generation metrics","tags":["metrics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"array","items":{"type":"string"},"description":"Device IDs to fetch metrics for","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Device IDs to fetch metrics for","name":"filterDeviceId","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Site IDs to fetch metrics for if grouped by site","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Site IDs to fetch metrics for if grouped by site","name":"filterSiteId","in":"query"},{"schema":{"type":"string","pattern":"^([1-9]\\d{0,1}[hwdmMy])$","description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","example":"24h"},"required":false,"description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","name":"filterRangeRelative","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range start point which to fetch metrics","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range start point which to fetch metrics","name":"filterRangeAfter","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","name":"filterRangeBefore","in":"query"},{"schema":{"type":"string","enum":["FIFTEEN_MINUTES","HOUR","DAY","WEEK","MONTH","YEAR"],"description":"Size of the window to fetch metrics for","example":"HOUR"},"required":false,"description":"Size of the window to fetch metrics for","name":"windowSize","in":"query"},{"schema":{"type":"string","enum":["SITE"],"description":"Facet to group the metrics by (e.g. site)","example":"SITE"},"required":false,"description":"Facet to group the metrics by (e.g. site)","name":"groupBy","in":"query"}],"responses":{"200":{"description":"Object with energy generation metrics","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"ts":{"type":["string","null"],"format":"date-time","description":"Timestamp of the data point","example":"2021-01-01T00:00:00Z"},"v":{"type":"number","description":"Total energy generated in watt hours for the time bucket","example":100},"deviceId":{"type":["string","null"],"description":"Device ID for the data point","example":"clmt0f0qq000g6jez6qa2sj4t"},"siteId":{"type":["string","null"]},"customerId":{"type":["string","null"]}},"required":["ts","v"]}},"meta":{"type":"object","properties":{"label":{"type":"string","description":"Label for the metric","example":"energyProducedWhr"},"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"],"description":"Unit of the metric","example":"WATT_HOURS"},"displayUnit":{"type":"string","description":"Display unit of the metric","example":"whr"},"sparse":{"type":"boolean","description":"Whether the metric is sparse","example":false},"series":{"type":["array","null"],"items":{"type":"string"},"description":"Series for the metric","example":["clmt0f0qq000g6jez6qa2sj4t"]},"domainMeta":{"type":"object","properties":{"label":{"type":"string"},"sparse":{"type":"boolean"},"rate":{"type":"object","properties":{"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"]},"displayUnit":{"type":"string"},"scaleFactor":{"type":"number"}},"required":["unit","displayUnit","scaleFactor"]}},"required":["label","sparse","rate"],"description":"Domain metadata for the metric"}},"required":["label","unit","displayUnit","sparse","domainMeta"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Invalid parameters provided.","details":{"error":"filterRangeAfter: Minimum range is 15 minutes"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Internal server error."}}}}}}}},"/metrics/grid-energy":{"get":{"description":"Metric detailing the net grid import/export energy in watt hours for each time bucket. Negative values represent energy export, positive values represent energy import. Applicable to sites or devices.","summary":"Get grid energy metrics","tags":["metrics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"array","items":{"type":"string"},"description":"Device IDs to fetch metrics for","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Device IDs to fetch metrics for","name":"filterDeviceId","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Site IDs to fetch metrics for if grouped by site","example":["clmt0f0qq000g6jez6qa2sj4t"]},"required":false,"description":"Site IDs to fetch metrics for if grouped by site","name":"filterSiteId","in":"query"},{"schema":{"type":"string","pattern":"^([1-9]\\d{0,1}[hwdmMy])$","description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","example":"24h"},"required":false,"description":"The time range relative to the current time to fetch metrics, if range, after, and before are all not set, this will default to '1d'","name":"filterRangeRelative","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range start point which to fetch metrics","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range start point which to fetch metrics","name":"filterRangeAfter","in":"query"},{"schema":{"type":["string","null"],"format":"date-time","description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","example":"2021-01-01T00:00:00Z"},"required":false,"description":"Time range end which to fetch metrics, used in combination with filterRangeAfter to limit the time range. If not set, defaults to now","name":"filterRangeBefore","in":"query"},{"schema":{"type":"string","enum":["FIFTEEN_MINUTES","HOUR","DAY","WEEK","MONTH","YEAR"],"description":"Size of the window to fetch metrics for","example":"HOUR"},"required":false,"description":"Size of the window to fetch metrics for","name":"windowSize","in":"query"},{"schema":{"type":"string","enum":["SITE"],"description":"Facet to group the metrics by (e.g. site)","example":"SITE"},"required":false,"description":"Facet to group the metrics by (e.g. site)","name":"groupBy","in":"query"}],"responses":{"200":{"description":"Object with grid energy metrics","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"ts":{"type":["string","null"],"format":"date-time","description":"Timestamp of the data point","example":"2021-01-01T00:00:00Z"},"v":{"type":"number","description":"Net grid energy in watt hours for the time bucket. Negative values represent export, positive values represent import.","example":100},"deviceId":{"type":["string","null"],"description":"Device ID for the data point","example":"clmt0f0qq000g6jez6qa2sj4t"},"siteId":{"type":["string","null"]},"customerId":{"type":["string","null"]}},"required":["ts","v"]}},"meta":{"type":"object","properties":{"label":{"type":"string","description":"Label for the metric","example":"gridEnergy"},"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"],"description":"Unit of the metric","example":"WATT_HOURS"},"displayUnit":{"type":"string","description":"Display unit of the metric","example":"whr"},"sparse":{"type":"boolean","description":"Whether the metric is sparse","example":false},"series":{"type":["array","null"],"items":{"type":"string"},"description":"Series for the metric","example":["clmt0f0qq000g6jez6qa2sj4t"]},"domainMeta":{"type":"object","properties":{"label":{"type":"string"},"sparse":{"type":"boolean"},"rate":{"type":"object","properties":{"unit":{"type":"string","enum":["AMPERE","CELSIUS","DAY","FAHRENHEIT","HOUR","KILOMETER","KILOMETER_PER_HOUR","METER","MILE","MILE_PER_HOUR","MINUTE","MONTH","PERCENT","POUNDS_CO2","SECOND","STRING","TIMESTAMP","UNIT","VOLT","WATT","WATT_HOURS","WEEK","YEAR"]},"displayUnit":{"type":"string"},"scaleFactor":{"type":"number"}},"required":["unit","displayUnit","scaleFactor"]}},"required":["label","sparse","rate"],"description":"Domain metadata for the metric"}},"required":["label","unit","displayUnit","sparse","domainMeta"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid parameters provided","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Invalid parameters provided.","details":{"error":"filterRangeAfter: Minimum range is 15 minutes"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"object","properties":{"error":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]}}}},"required":["message"],"example":{"message":"Internal server error."}}}}}}}},"/program-events/{eventId}":{"get":{"description":"Get details of a specific program event.","summary":"Get program event","tags":["Program Events"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier of the program event","example":"cllgn0u4r000008l7eazybfb2"},"required":true,"description":"The unique identifier of the program event","name":"eventId","in":"path"}],"responses":{"200":{"description":"Program event details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProgramEvent"}}}}}}},"/program-events":{"post":{"description":"Create a program event.","summary":"Create program event","tags":["Program Events"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"programInstanceId":{"type":"string","format":"cuid","description":"The unique identifier of the program instance to create the event for.","example":"cllgn0u4r000008l7eazybfbo"},"type":{"type":"string","description":"The type of the program event.","example":"discharge"},"startsAt":{"type":"string","format":"date-time","description":"The date and time the workspace program event starts.","example":"2025-01-01T00:00:00Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time the workspace program event ends.","example":"2025-01-01T00:00:00Z"},"dispatches":{"type":"array","items":{"type":"object","properties":{"tag":{"type":"string","description":"Tag associated with the devices to dispatch the command batch to.","example":"group-5"},"startsAt":{"type":"string","format":"date-time","description":"The date and time the command batch starts.","example":"2025-01-01T00:00:00Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time the command batch ends.","example":"2025-01-01T00:00:00Z"},"type":{"type":"string","enum":["battery:set-reserve","battery:set-operating-mode","charger:set-operating-mode","thermostat:set-operating-mode","thermostat:set-fan-mode","thermostat:pause-schedule","thermostat:resume-schedule","vehicle:set-charge-limit","vehicle:set-operating-mode"],"description":"The unique slug representing the type of command.","example":"thermostat:set-operating-mode"},"input":{"type":"object","properties":{},"additionalProperties":{},"description":"The input payload sent with the command. Includes necessary information for execution. Conforms to the schema provided on the command type.","example":{"operatingMode":"eco","heatTarget":70.5,"coolTarget":80.5}}},"required":["tag","startsAt","endsAt","type","input"]},"description":"The command batches associated with the program event."}},"required":["programInstanceId","type","startsAt","endsAt","dispatches"]}}}},"responses":{"201":{"description":"Program event created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProgramEvent"}}}},"400":{"description":"Bad request - invalid parameters","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Program event type is required"}}}}}},"401":{"description":"Unauthorized - invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Invalid API key"}}}}}},"403":{"description":"Forbidden - not authorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"404":{"description":"Program instance not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Program instance not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred while creating program event"}}}}}}}}},"/program-events/{id}":{"delete":{"description":"Delete a program event by ID. This endpoint is not currently implemented.","summary":"Delete program event","tags":["Program Events"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier of the program event","example":"cllgn0u4r000008l7eazybfb2"},"required":true,"description":"The unique identifier of the program event","name":"id","in":"path"}],"responses":{"501":{"description":"Not implemented","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message","example":"Not implemented"}},"required":["message"]}}}}}}},"/programInstances/{instanceId}":{"get":{"description":"Get details of a specific program instance by its ID without needing the program slug.","summary":"Get program instance by ID","tags":["Program Instances"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The ID of the program instance to retrieve.","example":"cllgn0u4r0000008l7eazybfbo"},"required":true,"description":"The ID of the program instance to retrieve.","name":"instanceId","in":"path"}],"responses":{"200":{"description":"Program instance details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProgramInstance"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"API key is required"}}}}}},"403":{"description":"Forbidden - not authorized to access the program instance","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"404":{"description":"Program instance not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Program instance not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred while fetching program instance"}}}}}}}}},"/programInstances":{"post":{"description":"Create a new instance of a program. This allows you to activate a program for a specific organization.","summary":"Create program instance","tags":["Program Instances"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProgramInstanceBody"}}}},"responses":{"201":{"description":"Program instance created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProgramInstance"}}}},"403":{"description":"Forbidden - not authorized to create program instance","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"404":{"description":"Program not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Program not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred while creating program instance"}}}}}}}}},"/programInstances/{instanceId}/enrollments":{"post":{"description":"Enroll a customer into a specific program instance.","summary":"Create an enrollment for a program instance","tags":["Program Instances","Enrollments"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The ID of the program instance to retrieve.","example":"cllgn0u4r0000008l7eazybfbo"},"required":true,"description":"The ID of the program instance to retrieve.","name":"instanceId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentInput"}}}},"responses":{"201":{"description":"Enrollment created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Enrollment"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"identificationType is required"}}}}}},"401":{"description":"Unauthorized - API key is required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"API key is required"}}}}}},"403":{"description":"Forbidden - not authorized to create enrollment","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred while creating enrollment"}}}}}}}},"get":{"description":"Returns a list of enrollments for a specific program instance. You can filter enrollments by eligibility status using the status query parameter.","summary":"Retrieve program instance enrollments","tags":["Program Instances","Enrollments"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The ID of the program instance to retrieve.","example":"cllgn0u4r0000008l7eazybfbo"},"required":true,"description":"The ID of the program instance to retrieve.","name":"instanceId","in":"path"},{"schema":{"type":"string"},"required":false,"in":"query","name":"status","description":"Filter enrollments by eligibility status."},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":9999,"default":100},"required":false,"name":"perPage","in":"query"}],"responses":{"200":{"description":"A list of enrollments for the program instance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Enrollment"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]}}}},"403":{"description":"Forbidden - not authorized to view enrollments","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"404":{"description":"Program instance not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Program instance not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred while fetching enrollments"}}}}}}}}},"/programInstances/{instanceId}/events":{"get":{"description":"List events of a specific program instance.","summary":"List program instance events","tags":["Program Instances"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"cuid","description":"The unique identifier of the program instance","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier of the program instance","name":"instanceId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Program instance events","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProgramEvent"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]}}}}}}},"/programs":{"get":{"description":"Returns a list of Programs (the catalog). By default, returns only those programs that have at least one active instance for the current organization.","summary":"Retrieve programs","tags":["programs"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"boolean"},"required":false,"in":"query","name":"include_all","description":"If true, returns all available programs; if false (default), returns only programs with an active instance."},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"A list of programs","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Program"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - API key is required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"API key is required"}}}}}},"403":{"description":"Forbidden - not authorized to access programs","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred while fetching programs"}}}}}}}}},"/programs/{programSlug}/instances":{"get":{"description":"Returns instances (activations) of a program for the current organization.","summary":"Get program instances","tags":["programs"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"programSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"A list of program instances","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProgramInstance"}},"page":{"type":"number"},"perPage":{"type":"number"},"totalItems":{"type":"number"},"totalPages":{"type":"number"}},"required":["data","page","perPage","totalItems","totalPages"]}}}}}}},"/programs/{programSlug}/instances/{instanceId}":{"get":{"description":"Get details of a specific program instance.","summary":"Get program instance","tags":["programs"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The slug of the program","example":"nyc-battery-program-2025"},"required":true,"description":"The slug of the program","name":"programSlug","in":"path"},{"schema":{"type":"string","description":"The unique identifier of the program instance","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier of the program instance","name":"instanceId","in":"path"}],"responses":{"200":{"description":"Program instance details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProgramInstance"}}}}}}},"/programs/{programSlug}":{"post":{"description":"Create a new instance of a program. This allows you to activate a program for a specific organization.","summary":"Create program instance","tags":["programs"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The slug of the program to create an instance for","example":"nyc-battery-program-2025"},"required":true,"description":"The slug of the program to create an instance for","name":"programSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the program instance","example":"NYC Battery Program 2025 - ConEd"}},"required":["name"]}}}},"responses":{"201":{"description":"Program instance created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"cuid","description":"The unique identifier for the program instance","example":"cllgn0u4r000008l7eazybfbo"},"programSlug":{"type":"string","description":"The slug of the program","example":"nyc-battery-program-2025"},"name":{"type":"string","description":"The name of the program instance","example":"NYC Battery Program 2025 - ConEd"},"createdAt":{"type":"string","format":"date-time","description":"The date and time the program instance was created","example":"2025-01-01T00:00:00Z"}},"required":["id","programSlug","name","createdAt"]}}}}}}},"/programs/reports/event-performance":{"get":{"description":"Returns aggregated event performance data for program reporting. Includes summary KPIs, per-event metrics with hourly energy buckets, and batch status.","summary":"Retrieve event performance report","tags":["programs","reports"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Filter by specific program ID","example":"prog_123"},"required":false,"description":"Filter by specific program ID","name":"program_id","in":"query"},{"schema":{"type":"string","format":"date","description":"Start date for time range filter (YYYY-MM-DD format)","example":"2024-01-01"},"required":false,"description":"Start date for time range filter (YYYY-MM-DD format)","name":"start_date","in":"query"},{"schema":{"type":"string","format":"date","description":"End date for time range filter (YYYY-MM-DD format)","example":"2024-12-31"},"required":false,"description":"End date for time range filter (YYYY-MM-DD format)","name":"end_date","in":"query"},{"schema":{"type":"string","enum":["json","csv","xlsx"],"default":"json","description":"Response format: json (default), csv, or xlsx"},"required":false,"description":"Response format: json (default), csv, or xlsx","name":"format","in":"query"},{"schema":{"type":"string","description":"Filter by specific event ID","example":"evt_456"},"required":false,"description":"Filter by specific event ID","name":"event_id","in":"query"},{"schema":{"type":"number","minimum":1,"maximum":100,"default":15,"description":"Maximum number of events to return (default: 15, max: 100)"},"required":false,"description":"Maximum number of events to return (default: 15, max: 100)","name":"max_events","in":"query"}],"responses":{"200":{"description":"Event performance report data","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"totalEvents":{"type":"number"},"devicesEnrolled":{"type":"number"},"devicesParticipated":{"type":"number"},"successRate":{"type":"number"},"totalEnergyKwh":{"type":"number"},"avgPeakKw":{"type":"number"}},"required":["totalEvents","devicesEnrolled","devicesParticipated","successRate","totalEnergyKwh","avgPeakKw"]},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"startsAt":{"type":"string"},"endsAt":{"type":["string","null"]},"label":{"type":"string"},"startHour":{"type":"number"},"durationHours":{"type":"number"},"totalEnergyKwh":{"type":"number"},"avgParticipationRate":{"type":"number"},"hourlyBuckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"energyKwh":{"type":"number"},"deviceCount":{"type":"number"},"participationRate":{"type":"number"}},"required":["bucket","energyKwh","deviceCount","participationRate"]}},"batchMetrics":{"type":"object","properties":{"issued":{"type":"number"},"succeeded":{"type":"number"},"failed":{"type":"number"},"pending":{"type":"number"}},"required":["issued","succeeded","failed","pending"]}},"required":["id","startsAt","endsAt","label","startHour","durationHours","totalEnergyKwh","avgParticipationRate","hourlyBuckets","batchMetrics"]}},"energyRange":{"type":"object","properties":{"min":{"type":"number"},"max":{"type":"number"}},"required":["min","max"]},"meta":{"type":"object","properties":{"eventCount":{"type":"number"},"deviceCount":{"type":"number"},"timeRange":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"]}},"required":["eventCount","deviceCount","timeRange"]}},"required":["summary","events","energyRange","meta"]}},"text/csv":{"schema":{"type":"string"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - API key is required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"API key is required"}}}}}},"403":{"description":"Forbidden - not authorized to access program reports","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred"}}}}}}}}},"/programs/reports/device-participation":{"get":{"description":"Returns device-level participation data for program reporting. Includes summary statistics and per-device participation status, energy metrics, and response times.","summary":"Retrieve device participation report","tags":["programs","reports"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Filter by specific program ID","example":"prog_123"},"required":false,"description":"Filter by specific program ID","name":"program_id","in":"query"},{"schema":{"type":"string","format":"date","description":"Start date for time range filter (YYYY-MM-DD format)","example":"2024-01-01"},"required":false,"description":"Start date for time range filter (YYYY-MM-DD format)","name":"start_date","in":"query"},{"schema":{"type":"string","format":"date","description":"End date for time range filter (YYYY-MM-DD format)","example":"2024-12-31"},"required":false,"description":"End date for time range filter (YYYY-MM-DD format)","name":"end_date","in":"query"},{"schema":{"type":"string","enum":["json","csv","xlsx"],"default":"json","description":"Response format: json (default), csv, or xlsx"},"required":false,"description":"Response format: json (default), csv, or xlsx","name":"format","in":"query"},{"schema":{"type":"string","description":"Filter by specific event ID","example":"evt_456"},"required":false,"description":"Filter by specific event ID","name":"event_id","in":"query"},{"schema":{"type":"number","minimum":1,"maximum":100,"default":15,"description":"Maximum number of events to return (default: 15, max: 100)"},"required":false,"description":"Maximum number of events to return (default: 15, max: 100)","name":"max_events","in":"query"}],"responses":{"200":{"description":"Device participation report data","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"enrolled":{"type":"number"},"participated":{"type":"number"},"participatedPercentage":{"type":"number"},"didNotParticipate":{"type":"number"},"didNotParticipatePercentage":{"type":"number"}},"required":["enrolled","participated","participatedPercentage","didNotParticipate","didNotParticipatePercentage"]},"devices":{"type":"array","items":{"type":"object","properties":{"deviceId":{"type":"string"},"deviceName":{"type":"string"},"manufacturer":{"type":"string"},"model":{"type":"string"},"manufacturerDisplayName":{"type":["string","null"]},"displayModelName":{"type":["string","null"]},"manufacturerLogoUrl":{"type":["string","null"]},"memberName":{"type":["string","null"]},"deviceType":{"type":"string"},"status":{"type":"string"},"energyKwh":{"type":["number","null"]},"dischargeEnergyKwh":{"type":["number","null"]},"responseTimeSeconds":{"type":["number","null"]}},"required":["deviceId","deviceName","manufacturer","model","manufacturerDisplayName","displayModelName","manufacturerLogoUrl","memberName","deviceType","status","energyKwh","dischargeEnergyKwh","responseTimeSeconds"]}},"meta":{"type":"object","properties":{"eventCount":{"type":"number"},"deviceCount":{"type":"number"},"timeRange":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"]}},"required":["eventCount","deviceCount","timeRange"]}},"required":["summary","devices","meta"]}},"text/csv":{"schema":{"type":"string"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - API key is required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"API key is required"}}}}}},"403":{"description":"Forbidden - not authorized to access program reports","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred"}}}}}}}}},"/programs/reports/fleet-health":{"get":{"description":"Returns fleet health report for enrolled devices. Includes health metrics (success rate, response time, connectivity), issues flagged for attention, and program enrollments. Uses a 30-day rolling window by default.","summary":"Retrieve fleet health report","tags":["programs","reports"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Filter by specific program ID","example":"prog_123"},"required":false,"description":"Filter by specific program ID","name":"program_id","in":"query"},{"schema":{"type":"string","format":"date","description":"Start date for time range filter (YYYY-MM-DD format)","example":"2024-01-01"},"required":false,"description":"Start date for time range filter (YYYY-MM-DD format)","name":"start_date","in":"query"},{"schema":{"type":"string","format":"date","description":"End date for time range filter (YYYY-MM-DD format)","example":"2024-12-31"},"required":false,"description":"End date for time range filter (YYYY-MM-DD format)","name":"end_date","in":"query"},{"schema":{"type":"string","enum":["json","csv","xlsx"],"default":"json","description":"Response format: json (default), csv, or xlsx"},"required":false,"description":"Response format: json (default), csv, or xlsx","name":"format","in":"query"}],"responses":{"200":{"description":"Fleet health report data","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"total":{"type":"number"},"online":{"type":"number"},"onlinePercent":{"type":"number"},"offline":{"type":"number"},"offlinePercent":{"type":"number"},"needsAttention":{"type":"number"}},"required":["total","online","onlinePercent","offline","offlinePercent","needsAttention"]},"devices":{"type":"array","items":{"type":"object","properties":{"deviceId":{"type":"string"},"deviceName":{"type":"string"},"deviceType":{"type":"string"},"manufacturer":{"type":"string"},"model":{"type":"string"},"manufacturerDisplayName":{"type":["string","null"]},"displayModelName":{"type":["string","null"]},"manufacturerLogoUrl":{"type":["string","null"]},"memberName":{"type":["string","null"]},"status":{"type":"string"},"uptimePercent":{"type":["number","null"]},"successPercent":{"type":["number","null"]},"avgResponseSeconds":{"type":["number","null"]},"issues":{"type":"array","items":{"type":"string"}},"programEnrollments":{"type":["array","null"],"items":{"type":"object","properties":{"programId":{"type":"string"},"programName":{"type":"string"}},"required":["programId","programName"]}}},"required":["deviceId","deviceName","deviceType","manufacturer","model","manufacturerDisplayName","displayModelName","manufacturerLogoUrl","memberName","status","uptimePercent","successPercent","avgResponseSeconds","issues","programEnrollments"]}},"meta":{"type":"object","properties":{"timeWindowLabel":{"type":"string"},"deviceCount":{"type":"number"},"dataAsOf":{"type":"string"}},"required":["timeWindowLabel","deviceCount","dataAsOf"]}},"required":["summary","devices","meta"]}},"text/csv":{"schema":{"type":"string"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - API key is required","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"API key is required"}}}}}},"403":{"description":"Forbidden - not authorized to access program reports","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"You are not authorized to perform this action"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"An error occurred"}}}}}}}}},"/schedules/tags/{tag}":{"post":{"description":"Create a new tag schedule.","summary":"Create new tag schedule","tags":["schedules"],"parameters":[{"schema":{"type":"string","description":"The tag that this schedule belongs to.","example":"tag-value"},"required":true,"description":"The tag that this schedule belongs to.","name":"tag","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deviceType":{"type":"string","enum":["battery","thermostat","vehicle"],"description":"The device type that this schedule belongs to.","example":"thermostat"},"schedule":{"type":"object","properties":{"timezone":{"type":"string","description":"A valid timezone string","example":"America/New_York"},"startsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule starts.","example":"2021-04-01T00:00:00.000Z"},"endsAt":{"type":"string","format":"date-time","description":"The date and time that this schedule ends.","example":"2021-04-01T00:00:00.000Z"},"defaultDeviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}}},"required":["timezone","defaultDeviceOperatingMode"]},"rules":{"type":"array","items":{"type":"object","properties":{"daysOfWeek":{"type":"array","items":{"type":"integer"},"example":[0,1,2,3,4,5,6],"description":"The days of the week the rule is active, numbered 0-6, where 0 is Sunday. In the example the rule is active every day of the week."},"startTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"endTime":{"type":"string","example":"13:00","description":"The hour and minute of the day the rule is to start or ending (in 24 hour clock)"},"deviceOperatingMode":{"type":"object","additionalProperties":{},"description":"The operating mode to set the device to during the specified time.","example":{"operatingMode":"auto","heatTarget":70,"coolTarget":78}}},"required":["daysOfWeek","startTime","endTime","deviceOperatingMode"]}},"force":{"type":"boolean","description":"If true, the tag schedule will be set even if it overlaps with an existing schedule. The overlapping schedule will be deleted. If false, we will throw an error if the schedule overlap. You need to delete the existing schedule manually before creating a new one.","example":false}},"required":["deviceType","schedule","rules"]}}}},"responses":{"200":{"description":"The newly created tag schedule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagSchedule"}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}},"500":{"description":"Something went wrong.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Something went wrong."]}},"required":["message"]}}}}}},"get":{"description":"Gets all schedules for a tag.","summary":"Get all schedules for a tag","tags":["schedules"],"parameters":[{"schema":{"type":"string","description":"The tag that this schedule belongs to.","example":"tag-value"},"required":true,"description":"The tag that this schedule belongs to.","name":"tag","in":"path"}],"responses":{"200":{"description":"The list of schedules by tag.","content":{"application/json":{"schema":{"type":"object","properties":{"tagSchedules":{"type":"array","items":{"$ref":"#/components/schemas/TagSchedule"}}},"required":["tagSchedules"]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}},"500":{"description":"Something went wrong.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Something went wrong."]}},"required":["message"]}}}}}},"delete":{"description":"Deletes all schedules for a tag.","summary":"Deletes all schedules for a tag","tags":["schedules"],"parameters":[{"schema":{"type":"string","description":"The tag that the schedules belongs to.","example":"tag-value"},"required":true,"description":"The tag that the schedules belongs to.","name":"tag","in":"path"}],"responses":{"200":{"description":"The list of deleted schedules by tag.","content":{"application/json":{"schema":{"type":"object","properties":{"tagSchedules":{"type":"array","items":{"$ref":"#/components/schemas/TagSchedule"}}},"required":["tagSchedules"]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}},"500":{"description":"Something went wrong.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Something went wrong."]}},"required":["message"]}}}}}}},"/schedules/tags/{tag}/{scheduleId}":{"get":{"description":"Gets a schedule for a tag by id.","summary":"Get a schedule for a tag by id","tags":["schedules"],"parameters":[{"schema":{"type":"string","description":"The tag that this schedule belongs to.","example":"tag-value"},"required":true,"description":"The tag that this schedule belongs to.","name":"tag","in":"path"},{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the device schedule.","example":"clpkn2je80006102tx7d0jhb8"},"required":true,"description":"The unique identifier for the device schedule.","name":"scheduleId","in":"path"}],"responses":{"200":{"description":"The tag schedule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagSchedule"}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}},"404":{"description":"The tag schedule was not found.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["The tag schedule was not found."]}},"required":["message"]}}}}}},"delete":{"description":"Deletes a tag's schedule by id.","summary":"Deletes a tag's schedule by id","tags":["schedules"],"parameters":[{"schema":{"type":"string","description":"The tag that the schedules belongs to.","example":"tag-value"},"required":true,"description":"The tag that the schedules belongs to.","name":"tag","in":"path"},{"schema":{"type":"string","format":"cuid","description":"The unique identifier for the schedule issued by Texture.","example":"cllgn0u4r000008l7eazybfbo"},"required":true,"description":"The unique identifier for the schedule issued by Texture.","name":"scheduleId","in":"path"}],"responses":{"200":{"description":"The deleted tag schedule.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/TagSchedule"},{"type":["object","null"]}]}}}},"400":{"description":"Invalid parameters provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid parameters provided."]}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}},"500":{"description":"Something went wrong.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Something went wrong."]}},"required":["message"]}}}}}}},"/connections":{"post":{"description":"Endpoint for setting up and creating a link session for a user to connect their devices.","summary":"Create a new link session","tags":["connections"],"requestBody":{"description":"The parameters for creating a new link session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLinkSessionParams"}}}},"responses":{"200":{"description":"Details about the created link session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkSessionResponse"}}}},"400":{"description":"Invalid request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}}},"required":["message"]}}}},"401":{"description":"Invalid API key provided.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Invalid API key provided."]}},"required":["message"]}}}}}}},"/manufacturers":{"get":{"description":"Get all manufacturers that Texture currently supports.","summary":"Get a list of manufacturers","tags":["manufacturers"],"responses":{"200":{"description":"Array with manufacturer data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Manufacturers"}}}}}}},"/organization":{"get":{"description":"Get details about the current organization.","summary":"Get the current organization","tags":["organizations"],"responses":{"200":{"description":"The organization details.","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the organization.","example":"Texture"},"domain":{"type":"string","description":"The domain of the organization.","example":"texturehq.com"},"logo":{"type":"string","format":"uri","description":"The URL to the organization's logo.","example":"https://texturehq.com/logo.png"},"url":{"type":"string","format":"uri","description":"The URL to the organization's website.","example":"https://texturehq.com"},"industry":{"type":"string","description":"The industry of the organization.","example":"Retail energy provider"},"preferredTemperatureUnit":{"type":"string","description":"The preferred temperature unit for the organization.","example":"FAHRENHEIT"},"oemSpecifics":{"type":"object","properties":{"enphase":{"type":"object","properties":{"gridServicesAuthorizationUrl":{"type":"string","format":"uri","description":"Unique Enphase Grid Services authorization url for organization. Only populated if enabled for the organization.","example":"https://enphase.connect.texturehq.com/d1fcb908-0673-47c6-98dd-708ccaf74c64"}}}},"description":"Contains any oem specific data, if applicable, for the organization."}},"required":["name","domain","preferredTemperatureUnit"]}}}}}},"post":{"description":"Create a new organization. The authenticated user will become the owner.","summary":"Create Organization","tags":["organizations"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the organization"},"domain":{"type":"string","description":"The domain of the organization (e.g. 'example.com')"},"logo":{"type":"string","format":"uri","description":"URL to the organization's logo"},"industry":{"type":"string","description":"The industry of the organization"},"preferredTemperatureUnit":{"type":"string","enum":["FAHRENHEIT","CELSIUS"],"description":"The preferred temperature unit for the organization"}},"required":["name","domain"]}}}},"responses":{"201":{"description":"The organization that was successfully created.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the organization"},"name":{"type":"string","description":"The name of the organization"},"domain":{"type":"string","description":"The domain of the organization"},"logo":{"type":["string","null"],"description":"URL to the organization's logo"},"industry":{"type":["string","null"],"description":"The industry of the organization"},"preferredTemperatureUnit":{"type":"string","description":"The preferred temperature unit for the organization"},"createdAt":{"type":"string","description":"The date and time the organization was created"}},"required":["id","name","domain","preferredTemperatureUnit","createdAt"]}}}},"400":{"description":"Bad Request - Invalid input data.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error - Error creating organization.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}},"/public/manufacturers":{"get":{"description":"Get all manufacturers supported by Texture. This endpoint is public and does not require authentication.","summary":"Get a public list of manufacturers","tags":["Public"],"security":[],"responses":{"200":{"description":"Array of manufacturer data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicManufacturers"}}}},"429":{"description":"Rate limit exceeded."}}}},"/sites":{"get":{"description":"Get a list of sites","summary":"Get all sites for a workspace with additional optional filtering","tags":["sites"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"array","items":{"type":"string"},"description":"The reference ID or customerID to filter sites by.","example":["9bb290c8-fe97-46ce-92a8-952823164277"]},"required":false,"description":"The reference ID or customerID to filter sites by.","name":"referenceId","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Object with site data and pagination info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sites"}}}},"403":{"description":"Unauthorized"},"404":{"description":"Not found"}}},"post":{"description":"Create a new site within the workspace associated with the API key.","summary":"Create Site","tags":["sites"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"city":{"type":"string"},"country":{"type":"string"},"postalCode":{"type":"string"},"state":{"type":"string"},"streetOne":{"type":"string"},"streetTwo":{"type":"string"},"customerId":{"type":"string","description":"Optional customer ID to associate with the site"}},"required":["city","country","postalCode","state","streetOne"]}}}},"responses":{"201":{"description":"The site that was successfully created.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"location":{"type":"object","properties":{"streetOne":{"type":"string"},"streetTwo":{"type":["string","null"]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}},"required":["streetOne","city","state","postalCode","country"]},"provider":{"type":["string","null"]},"name":{"type":["string","null"]},"workspaceId":{"type":"string"},"referenceId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","location","workspaceId","createdAt"]}}}},"400":{"description":"Bad Request - Invalid input data.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized - Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error - Error creating site.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}},"/sites/{id}":{"get":{"description":"Get a site by ID.","summary":"Get a site for a workspace by ID.","tags":["sites"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","description":"The ID of the site to retrieve.","required":true},{"name":"include","in":"query","description":"Additional data to include with the site response (comma-separated values).","required":false,"schema":{"type":"array","items":{"type":"string","enum":["weather","permits","statements","intervals","energy-modeling"]}},"style":"form","explode":false}],"responses":{"200":{"description":"Object with Site and associated data.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Site"},{"description":"The schema for the response of the GET /sites/{id} endpoint."}]}}}},"403":{"description":"Unauthorized"},"404":{"description":"Not found"}}},"patch":{"description":"Update an existing site. All fields are optional — only provided fields will be updated. When location fields (streetOne, city, etc.) or coordinates (latitude, longitude) are provided, the site's location will be updated.","summary":"Update a site","tags":["sites"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","description":"The ID of the site to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":["string","null"],"description":"User-provided name for the site."},"referenceId":{"type":["string","null"],"description":"Customer reference ID for the site."},"streetOne":{"type":"string","description":"Primary street address."},"streetTwo":{"type":["string","null"],"description":"Secondary street address."},"city":{"type":"string","description":"City where the site is located."},"state":{"type":"string","description":"State or province."},"postalCode":{"type":"string","description":"Postal or ZIP code."},"country":{"type":"string","description":"Country."},"latitude":{"type":"number","minimum":-90,"maximum":90,"description":"Latitude coordinate."},"longitude":{"type":"number","minimum":-180,"maximum":180,"description":"Longitude coordinate."}}}}}},"responses":{"200":{"description":"The updated site.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"referenceId":{"type":["string","null"]},"workspaceId":{"type":"string"},"location":{"type":"object","properties":{"streetOne":{"type":"string"},"streetTwo":{"type":["string","null"]},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]}},"required":["streetOne","city","state","postalCode","country"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","workspaceId","location","createdAt"]}}}},"400":{"description":"Bad Request — Invalid input data.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"Unauthorized — Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not Found — Site does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}},"/sites/{id}/alerts":{"get":{"description":"Get a list of alerts for a site","summary":"Get all alerts for a site with additional optional filtering","tags":["alerts","sites"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"The site ID to get alerts for","example":"cllgn0u4r000008l7eazybfbo"},{"schema":{"type":"string"},"required":false,"in":"query","name":"externalId","description":"Filter alerts by external ID.","example":"124254116"},{"schema":{"type":"string","enum":["CRITICAL","WARNING","INFO"],"description":"The severity level of the alert.","example":"WARNING"},"required":false,"description":"Filter alerts by severity level.","in":"query","name":"severity"},{"schema":{"type":"string","enum":["OPEN","ACKNOWLEDGED","IGNORED","RESOLVED"],"description":"The current status of the alert.","example":"OPEN"},"required":false,"description":"Filter alerts by status.","in":"query","name":"status"},{"schema":{"type":"string"},"required":false,"in":"query","name":"deviceId","description":"Filter alerts by device ID.","example":"cllgn0u4r000008l7eazybfbo"},{"schema":{"type":"string"},"required":false,"in":"query","name":"sourceSystem","description":"Filter alerts by source system.","example":"Inverter 01"},{"schema":{"type":"string"},"required":false,"in":"query","name":"manufacturerDeviceId","description":"Filter alerts by manufacturer device ID.","example":"123456"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1},"required":false,"in":"query","name":"page","description":"The page number to fetch devices from."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"in":"query","name":"perPage","description":"The number of devices per page to return."}],"responses":{"200":{"description":"Object with alerts data and pagination info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alerts"}}}},"403":{"description":"Unauthorized"},"404":{"description":"Not found"}}}}},"webhooks":{}}