openapi: 3.2.0 info: title: Reposit Power Market Dispatch API description: 'Documentation for the Reposit Power Market API. Used by fleet.repositpower.com and related services. Please review our [versioning and support policy](https://gist.github.com/mleonard87/d5ed0a82760ceb75adc7df0d62bf9c31) before using the API. ' contact: url: https://www.repositpower.com/ email: api@repositpower.com version: 1.0.0 servers: - url: https://marketapi.repositpower.com/ tags: - name: Dispatch description: API end-points related to export dispatches. paths: /api/dispatches: get: tags: - Dispatch summary: All Dispatches description: Return all dispatches/support requests with their basic details. parameters: - name: filter in: query description: A filter to apply to the returned dispatches/support requests. One of UPCOMING, COMPLETED, INPROGRESS or left empty to view all. schema: type: string enum: - UPCOMING - COMPLETED - INPROGRESS - name: offset in: query description: An integer to offset the results by - to use for paging through the total results. schema: type: number default: 0.0 - name: limit in: query description: An integer to limit the results by - to use for paging through the total results. schema: type: number default: 100.0 responses: 200: description: OK content: application/json: schema: type: object example: data: - component: battery id: bf6e5c09-9e25-4ff0-a2af-d81185e4abc4 powerstation: 05bf160741c343ce869d0e9ec7b2ad88 request: duration: 3600 powerFactor: 0.7 powerFactorLeadLag: LEADING realPowerP: 38.2 startTime: 1497336240 state: COMPLETED 401: description: Invalid access token. If the error code in the returned JSON is `expired_token`, it means you need to request a new access token through the `/auth/login/` route using your username and password. content: application/json: schema: type: object example: error: expired_token message: The token you provided has expired. status: error security: - AccessToken: [] post: tags: - Dispatch summary: Create Dispatch description: Creates a new dispatch with the specified details requestBody: description: The dispatch to create. content: application/json: schema: required: - duration - powerstation - realPowerP - startTime type: object properties: powerstation: type: string description: The id of the powerstation to dispatch startTime: type: integer description: The unix timestamp at which this dispatch should start. duration: type: integer description: The duration of the request in seconds. realPowerP: type: number description: The amount of real power to be dispatched in kW powerFactor: type: number description: The requested power factor for this dispatch/support request. This is only accepted if your account has been enabled for power factor/voltage control. powerFactorLeadLag: type: string description: Used only when power_factor is also present and indicates if the specified power factor is LEADING or LAGGING. This is only accepted if your account has been enabled for power factor/voltage control. enum: - LEADING - LAGGING example: powerstation: 57dfc43d3b9a4c99b05c7794f5d6abb3 startTime: 1505214000 duration: 28800 realPowerP: 2.6 powerFactor: 0.7 powerFactorLeadLag: LAGGING required: false responses: 200: description: OK content: application/json: schema: type: object example: data: id: 0c127211-bc31-4d11-8f32-19008c75cf80 status: OK 401: description: Invalid access token. If the error code in the returned JSON is `expired_token`, it means you need to request a new access token through the `/auth/login/` route using your username and password. content: application/json: schema: type: object example: error: expired_token message: The token you provided has expired. status: error security: - AccessToken: [] x-codegen-request-body-name: dispatch /api/dispatches/{dispatchId}: get: tags: - Dispatch summary: Get Single Dispatch description: Return detailed data about a specific dispatch/support request as specified by the dispatchId in the URL. parameters: - name: dispatchId in: path description: The ID of the dispatch/support request for which to fetch details. required: true schema: type: string responses: 200: description: OK content: application/json: schema: type: object example: data: - component: battery createdAt: 1497336240 currentResponse: deploymentsAccepted: 0 deploymentsResponded: 0 powerFactor: 0.7 powerFactorLeadLag: LEADING realPowerP: 38.2 rejectedRealPowerP: 0.21 id: bf6e5c09-9e25-4ff0-a2af-d81185e4abc4 powerstation: 05bf160741c343ce869d0e9ec7b2ad88 prediction: data: - -5.960000001858923e-08 - -5.960000001858923e-08 - -5.960000001858923e-08 - -5.960000001858923e-08 - -2.97999999121501e-08 - -8.94000000695172e-08 - -1.49000000115862e-07 - -2.98000000231724e-08 - -1.489999998938174e-07 - -2.98000000231724e-08 - -8.93999999584949e-08 - -2.9700000014898364e-08 - -8.940000001400605e-08 deltaSeconds: 1800 startTime: 1505181600 request: deploymentsRequested: 6 duration: 3600 powerFactor: 0.7 powerFactorLeadLag: LEADING realPowerP: 38.2 startTime: 1497336240 nodes: - f7b05c5632334403ac0895959f8d00e7 - 4f0cf230c728478da0822aa7f2d1f9ef - 56af6a12ae9049298aaa38cde5781145 - 3b904d6c1a8549f3adc0b0dd4a7e9fc6 - 50cafb993f54499cb03396f236dfee6d - f93c98b6df01472283bc9fbb5d7a6d8d - 4858794e8ab3410cb523fcf03e4cc573 state: COMPLETED 401: description: Invalid access token. If the error code in the returned JSON is `expired_token`, it means you need to request a new access token through the `/auth/login/` route using your username and password. content: application/json: schema: type: object example: error: expired_token message: The token you provided has expired. status: error security: - AccessToken: [] components: securitySchemes: AccessToken: type: apiKey description: 'To authenticate you need to generate an API Key using Reposit Fleet. API Keys can be limited to whitelisted origin IP addresses for security and do not expire making them more suitable to server-to-server comms. API keys may also be revoked via Reposit Fleet. ### Creating an API Key API keys for the Reposit Market API can be generated by first logging in to [Reposit Fleet](https://fleet.repositpower.com). Once you have logged in click your username at the top right and then select "[User Settings](https://fleet.repositpower.com/user/settings)" Within the section labelled "API Keys" click the "Add API Key" button. Within the dialog that appears you will be able to name the key you are generating and specify a whitelist of IP addresses that this token is valid for. You will also need to confirm your password. When you have configured your keys settings click "Add" and your newly created key will be displayed - the key itself is not stored by Reposit and therefore this is your only opportunity to save the key securely. **Note**: The generated key authenticates as the account that you are currently logged in to Reposit Fleet for and as such will carry the same permissions. If you require a locked down account it is recommend that you create a new account for Reposit Fleet and generate the API Key for this account. ### Using an API Key Simply add `Bearer ` followed by the API key in the `Authorization` header of any request to Market API. e.g.: `Authorization: Bearer A2YWQiLCJpc3...` ### Revoking an API Key If an API Key becomes lost or is no longer required then the API Key can be revoked. Login to Reposit Fleet as the user for which you wish to revoke the API Key and proceed to [User Settings](https://fleet.repositpower.com/user/settings). From within the "API Keys" you will be able to see a table of all issued API Keys, find the API Key you wish to revoke and select the "Remove" link in the table. Once an API Key is removed it will cease to work immediately and can not be recovered or reinstated. ' name: Bearer in: header