{ "info": { "title": "Equiwatt API", "version": "0.9" }, "openapi": "3.1.0", "servers": [ { "url": "/" } ], "paths": { "/assets": { "post": { "tags": [ "Assets" ], "summary": "Create assets", "description": "Create multiple asset objects", "operationId": "AssetsCreateBulkAssets", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Asset" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Asset" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/assets/{asset_id}/baseline-at/{timestamp}": { "get": { "tags": [ "Assets" ], "summary": "Energy baseline at", "description": "Get energy baseline for an asset at a given time", "operationId": "AssetsAssetIdBaselineAtTimestampGetBaseline", "parameters": [ { "name": "asset_id", "in": "path", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "timestamp", "in": "path", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssetEnergyBaseline" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/assets/{asset_id}/baselines": { "get": { "tags": [ "Assets" ], "summary": "Energy baseline", "description": "Get energy baseline for an asset", "operationId": "AssetsAssetIdBaselinesGetBaselines", "parameters": [ { "name": "asset_id", "in": "path", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "start_ts", "in": "query", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "end_ts", "in": "query", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/AssetEnergyBaseline" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/assets/{asset_id}/energy-consumption": { "post": { "tags": [ "Assets" ], "summary": "Create energy consumption", "description": "Save energy consumption of asset", "operationId": "AssetsAssetIdEnergyConsumptionSaveConsumption", "parameters": [ { "name": "asset_id", "in": "path", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "requestBody": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/EnergyConsumption" }, "type": "array" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssetEnergyConsumption" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/energy-consumption": { "post": { "tags": [ "Energy Consumption" ], "summary": "Save energy consumption", "description": "Bulk save energy consumption", "operationId": "EnergyConsumptionCreateUser", "requestBody": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/AssetEnergyConsumption" }, "type": "array" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/events": { "get": { "tags": [ "Events" ], "summary": "List events", "description": "Get all events", "operationId": "EventsGetEvents", "parameters": [ { "name": "scheme_type", "in": "query", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "event_state", "in": "query", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/Event" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/events/{event_id}/assets": { "get": { "tags": [ "Events" ], "summary": "List assets", "description": "Get all assets associated with an event", "operationId": "EventsEventIdAssetsGetEventAssets", "parameters": [ { "name": "asset_state", "in": "query", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "event_id", "in": "path", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/EventAsset" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/events/{event_id}/portfolios": { "get": { "tags": [ "Events" ], "summary": "List portfolios", "description": "Get all portfolios associated with an event", "operationId": "EventsEventIdPortfoliosGetEventPortfolios", "parameters": [ { "name": "event_id", "in": "path", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/events/schemes": { "get": { "tags": [ "Events" ], "summary": "Schemes", "description": "Get available event schemes", "operationId": "EventsSchemesGetEventSchemes", "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/EventScheme" }, "type": "array" } } } } }, "deprecated": false } }, "/portfolios/{portfolio_id}/assets": { "post": { "tags": [ "Portfolio" ], "summary": "Create Assets", "description": "Create assets under a portfolio", "operationId": "PortfoliosPortfolioIdAssetsCreate", "parameters": [ { "name": "portfolio_id", "in": "path", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/portfolios": { "get": { "tags": [ "Portfolio" ], "summary": "List portfolios", "description": "Get portfolios", "operationId": "PortfoliosList", "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/Portfolio" }, "type": "array" } } } } }, "deprecated": false }, "post": { "tags": [ "Portfolio" ], "summary": "Create portfolio", "description": "Create a portfolio", "operationId": "PortfoliosCreate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PortfolioIn" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Portfolio" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/users": { "post": { "tags": [ "Users" ], "summary": "Create User", "description": "Create a user on equiwatt", "operationId": "UsersCreateUser", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/webhooks": { "get": { "tags": [ "Webhooks" ], "summary": "List webhooks", "description": "Get all subscribed webhooks", "operationId": "WebhooksList", "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Webhook" } } } } }, "deprecated": false }, "post": { "tags": [ "Webhooks" ], "summary": "Create webhook", "description": "Subscribe to a webhook", "operationId": "WebhooksSubscribe", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookIn" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Webhook" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/webhooks/test": { "post": { "tags": [ "Webhooks" ], "summary": "Test webhook", "description": "Test a webhook by sending a test payload", "operationId": "WebhooksTestTest", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookTest" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/webhooks/{webhook_id}": { "delete": { "tags": [ "Webhooks" ], "summary": "Delete webhook", "description": "Unsubscribe from a webhook", "operationId": "WebhooksWebhookIdUnsubscribe", "parameters": [ { "name": "webhook_id", "in": "path", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "204": { "description": "Request fulfilled, nothing follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } } }, "components": { "schemas": { "Asset": { "properties": { "asset_id": { "type": "string" }, "name": { "type": "string" }, "user_id": { "oneOf": [ { "type": "null" }, { "type": "string" } ] } }, "type": "object", "required": [ "asset_id", "name" ], "title": "Asset" }, "AssetEnergyBaseline": { "properties": { "asset_id": { "type": "string" }, "timestamp": { "type": "integer" }, "baseline": { "type": "number" } }, "type": "object", "required": [ "asset_id", "baseline", "timestamp" ], "title": "AssetEnergyBaseline" }, "AssetEnergyConsumption": { "properties": { "asset_id": { "type": "string" }, "timestamp": { "type": "integer" }, "value": { "type": "number" } }, "type": "object", "required": [ "asset_id", "timestamp", "value" ], "title": "AssetEnergyConsumption" }, "EnergyConsumption": { "properties": { "timestamp": { "type": "integer" }, "value": { "type": "number" } }, "type": "object", "required": [ "timestamp", "value" ], "title": "EnergyConsumption" }, "Event": { "properties": { "scheme": { "$ref": "#/components/schemas/EventScheme" }, "event_id": { "type": "integer" }, "state": { "type": "string" } }, "type": "object", "required": [ "event_id", "scheme", "state" ], "title": "Event" }, "EventAsset": { "properties": { "asset_id": { "type": "string" }, "state": { "type": "string" } }, "type": "object", "required": [ "asset_id", "state" ], "title": "EventAsset" }, "EventScheme": { "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "type": "object", "required": [ "id", "name" ], "title": "EventScheme" }, "Portfolio": { "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "created": { "type": "integer" } }, "type": "object", "required": [ "created", "description", "id", "name" ], "title": "Portfolio" }, "PortfolioIn": { "properties": { "name": { "type": "string" }, "description": { "type": "string" } }, "type": "object", "required": [ "description", "name" ], "title": "PortfolioIn" }, "User": { "properties": { "user_id": { "type": "string" }, "name": { "type": "string" }, "email": { "oneOf": [ { "type": "null" }, { "type": "string" } ] } }, "type": "object", "required": [ "name", "user_id" ], "title": "User" }, "Webhook": { "properties": { "id": { "type": "integer" }, "url": { "type": "string" }, "secret": { "type": "string" }, "events": { "items": { "type": "string" }, "type": "array" } }, "type": "object", "required": [ "events", "id", "secret", "url" ], "title": "Webhook" }, "WebhookIn": { "properties": { "url": { "type": "string" }, "secret": { "type": "string" }, "events": { "items": { "type": "string" }, "type": "array" } }, "type": "object", "required": [ "events", "secret", "url" ], "title": "WebhookIn" }, "WebhookTest": { "properties": { "id": { "type": "integer" }, "events": { "items": { "type": "string" }, "type": "array" } }, "type": "object", "required": [ "events", "id" ], "title": "WebhookTest" } } } }