ClimateAI Account API

account related operations

OpenAPI Specification

climateai-account-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: ClimateAI Platform Account API
  version: '1.0'
  description: ClimateAI authentication and routing gateway for platform services
servers:
- url: /
security:
- jwt: []
tags:
- name: account
  description: account related operations
paths:
  /account/:
    post:
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account_response'
        '500':
          description: Error creating account
        '201':
          description: Successfully created new account.
      operationId: Create an account
      tags:
      - account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account_payload'
        required: true
    get:
      responses:
        '200':
          description: Successfully retrieved accounts.
        '500':
          description: Error retrieving accounts.
        '204':
          description: No accounts found.
      summary: Gets all accounts
      operationId: Retrieve all accounts
      tags:
      - account
  /account/search:
    post:
      responses:
        '200':
          description: Accounts successfully fetched.
        '500':
          description: Error searching.
        '204':
          description: No accounts found.
      operationId: Search accounts
      tags:
      - account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/search_payload'
        required: true
  /account/{account_id}:
    parameters:
    - name: account_id
      in: path
      required: true
      schema:
        type: string
    put:
      responses:
        '200':
          description: Successfully updated account.
        '500':
          description: Error updating account.
        '404':
          description: No account with given ID found.
      operationId: Update information about a specific account
      tags:
      - account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account%20update'
        required: true
    delete:
      responses:
        '200':
          description: Successfully disabled account.
        '500':
          description: Error disabling account.
        '404':
          description: No account with given ID found.
      operationId: Disable account by id
      tags:
      - account
    get:
      responses:
        '200':
          description: Successfully retrieved account.
        '500':
          description: Error retrieving account.
        '404':
          description: No account with given ID found.
      operationId: Retrieve account by id
      tags:
      - account
  /account/{account_id}/is_onboarded:
    parameters:
    - name: account_id
      in: path
      required: true
      schema:
        type: string
    post:
      responses:
        '200':
          description: Successfully updated is_onboarded account
        '500':
          description: Error updating account.
        '404':
          description: No account with given ID found.
      operationId: Update an account is_onboarded
      tags:
      - account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account_is_onboarded'
        required: true
  /account/{account_id}/platform:
    parameters:
    - name: account_id
      in: path
      required: true
      schema:
        type: string
    get:
      responses:
        '200':
          description: succesfully retrieved platform
        '500':
          description: Error getting platform linked to account
        '404':
          description: Account not found.
      operationId: Gets a platform based on the account_id
      tags:
      - account
  /account/{account_id}/user/{user_id}/relation:
    parameters:
    - name: account_id
      in: path
      required: true
      schema:
        type: string
    - name: user_id
      in: path
      required: true
      schema:
        type: string
    post:
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account_user_relation_response'
        '500':
          description: Error creating account-user relationship.
        '201':
          description: Successfully created new account-user relationship.
      operationId: Add a new account-user relationship
      tags:
      - account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account_user_relation_payload'
        required: true
    put:
      responses:
        '200':
          description: Successfully modified account-user relationship.
        '500':
          description: Error modifying account-user relationship.
      operationId: Modify an existing account-user relationship
      tags:
      - account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account_user_relation_payload'
        required: true
    delete:
      responses:
        '500':
          description: Error removing account-user relation.
        '404':
          description: No relation found for the account/user combination.
        '200':
          description: Successfully deleted account-user relation.
      operationId: Delete an account-user relation
      tags:
      - account
    get:
      responses:
        '200':
          description: Successfully retrieved relation.
        '500':
          description: Error retrieving relation.
        '404':
          description: No relation found for the account/user combination.
      operationId: Get a relation between the account/user
      tags:
      - account
  /account/{account_id}/user/{user_id}/relation/activate:
    parameters:
    - name: account_id
      in: path
      required: true
      schema:
        type: string
    - name: user_id
      in: path
      required: true
      schema:
        type: string
    post:
      responses:
        '200':
          description: Successfully activated account-user relationship.
        '500':
          description: Error activating account-user relationship.
      operationId: Activate an account-user relationship
      tags:
      - account
components:
  schemas:
    nested_account:
      required:
      - contact_info
      - created_at
      - currency
      - id
      - is_onboarded
      - logo_url
      - name
      - updated_at
      properties:
        id:
          type: string
          description: Account ID
        logo_url:
          type: string
          description: path to stored logo
          default: https://climate-ai-platform-prod-storage.s3.us-east-2.amazonaws.com/account_logos/climateai_logo.png
        is_onboarded:
          type: boolean
          description: Is the account onboarded
        created_at:
          type: string
          description: created timestamp
        updated_at:
          type: string
          description: last updated timestamp
        platform_id:
          type: string
          description: platform ID
        logo_b64:
          type: string
          description: Account logo image in Base64
        name:
          type: string
          description: Account name.
        currency:
          type: string
          description: Currency used by the account.
        contact_info:
          description: Contact information used by the account.
          allOf:
          - $ref: '#/components/schemas/contact_info_payload'
        status:
          type: string
          description: Account status
          example: live
          enum:
          - live
          - sales
          - terminated
        parent_id:
          type: string
          description: Account ID of the parent account.
        is_internal:
          type: boolean
          description: If account is internal or not
      type: object
    account_payload:
      required:
      - contact_info
      - currency
      - name
      properties:
        logo_b64:
          type: string
          description: Account logo image in Base64
        name:
          type: string
          description: Account name.
        currency:
          type: string
          description: Currency used by the account.
        contact_info:
          description: Contact information used by the account.
          allOf:
          - $ref: '#/components/schemas/contact_info_payload'
        status:
          type: string
          description: Account status
          example: live
          enum:
          - live
          - sales
          - terminated
        platform_id:
          type: string
          description: platform ID
        parent_id:
          type: string
          description: Account ID of the parent account.
        is_internal:
          type: boolean
          description: If account is internal or not
      type: object
    account_user_relation_response:
      required:
      - account_id
      - created_at
      - email_sent
      - last_used
      - updated_at
      - user_id
      properties:
        account_id:
          type: string
          description: Account ID
        user_id:
          type: string
          description: User ID
        role_id:
          type: string
          description: Role ID
        created_at:
          type: string
          description: created timestamp
        updated_at:
          type: string
          description: last updated timestamp
        email_sent:
          type: string
          description: email type sent
        last_used:
          type: string
          description: last time this relation was used
      type: object
      additionalProperties: false
    criteria:
      properties:
        and:
          type: array
          items:
            $ref: '#/components/schemas/search_filter'
        or:
          type: array
          items:
            $ref: '#/components/schemas/search_filter'
      type: object
    account_user_relation_payload:
      properties:
        role_id:
          type: string
          description: Role ID
      type: object
      additionalProperties: false
    search_payload:
      properties:
        filter_by:
          $ref: '#/components/schemas/criteria'
        order_by:
          type: array
          items:
            type: string
        pagination:
          $ref: '#/components/schemas/pagination'
      type: object
    account_response:
      required:
      - contact_info
      - created_at
      - currency
      - id
      - is_onboarded
      - logo_url
      - name
      - updated_at
      properties:
        id:
          type: string
          description: Account ID
        logo_url:
          type: string
          description: path to stored logo
          default: https://climate-ai-platform-prod-storage.s3.us-east-2.amazonaws.com/account_logos/climateai_logo.png
        is_onboarded:
          type: boolean
          description: Is the account onboarded
        created_at:
          type: string
          description: created timestamp
        updated_at:
          type: string
          description: last updated timestamp
        platform_id:
          type: string
          description: platform ID
        logo_b64:
          type: string
          description: Account logo image in Base64
        name:
          type: string
          description: Account name.
        currency:
          type: string
          description: Currency used by the account.
        contact_info:
          description: Contact information used by the account.
          allOf:
          - $ref: '#/components/schemas/contact_info_payload'
        status:
          type: string
          description: Account status
          example: live
          enum:
          - live
          - sales
          - terminated
        parent_id:
          type: string
          description: Account ID of the parent account.
        is_internal:
          type: boolean
          description: If account is internal or not
        children:
          type: array
          description: Child accounts
          items:
            $ref: '#/components/schemas/nested_account'
      type: object
    search_filter:
      required:
      - field_name
      - field_value
      - operator
      properties:
        field_name:
          type: string
        operator:
          type: string
        field_value:
          type: string
      type: object
    pagination:
      properties:
        page:
          type: integer
        per_page:
          type: integer
        all:
          type: boolean
      type: object
    contact_info_payload:
      required:
      - address
      - email
      - name
      properties:
        name:
          type: string
          description: Name of the primary contact for the account.
        email:
          type: string
          description: Primary contact email of the account.
        address:
          type: string
          description: Primary address for the account.
      type: object
      additionalProperties: false
    account_is_onboarded:
      required:
      - is_onboarded
      properties:
        is_onboarded:
          type: boolean
          description: Boolean for is_onboarded
      type: object
  securitySchemes:
    jwt:
      type: apiKey
      in: header
      name: Authorization
    apikey:
      type: apiKey
      in: header
      name: X-Api-Key