openapi: 3.1.0
info:
  title: Environmental Impact API
  description: The Environmental Impact API offers tools that help you to quantify
    the environmental impact of using Scaleway's services.
  version: v1alpha1
servers:
- url: https://api.scaleway.com
components:
  schemas:
    google.protobuf.Timestamp:
      type: string
      format: date-time
      nullable: true
    scaleway.environmental_impact.v1alpha1.GetOrganizationEnabledResponse:
      type: object
      properties:
        enabled:
          type: boolean
          description: Whether the environmental impact feature is enabled for the
            organization.
      required:
      - enabled
      x-properties-order:
      - enabled
    scaleway.environmental_impact.v1alpha1.UpdateOrganizationEnabledResponse:
      type: object
    scaleway.environmental_impact.v1alpha1.UsageDashboardMetrics:
      type: object
      properties:
        metrics:
          type: array
          description: The list of impact metrics per project/SKU-combination within
            the requested time frame. Ordered by project ID and SKU.
          items:
            $ref: '#/components/schemas/scaleway.environmental_impact.v1alpha1.UsageDashboardMetrics.Metric'
      required:
      - metrics
      x-properties-order:
      - metrics
    scaleway.environmental_impact.v1alpha1.UsageDashboardMetrics.Metric:
      type: object
      properties:
        impact_co2_metric:
          type: object
          description: Timeseries of estimated CO2 emissions in kgCO2eq/kW. The number
            of points matches the number of points in the usage metric.
          properties:
            name:
              type: string
            points:
              type: array
              items:
                $ref: '#/components/schemas/scaleway.std.TimeSeries.Point'
            metadata:
              type: object
              properties:
                <metadataKey>:
                  type: string
              additionalProperties: true
          x-properties-order:
          - name
          - points
          - metadata
        impact_water_metric:
          type: object
          description: Timeseries of estimated cubic meters of water used. The number
            of points matches the number of points in the usage metric.
          properties:
            name:
              type: string
            points:
              type: array
              items:
                $ref: '#/components/schemas/scaleway.std.TimeSeries.Point'
            metadata:
              type: object
              properties:
                <metadataKey>:
                  type: string
              additionalProperties: true
          x-properties-order:
          - name
          - points
          - metadata
        usage_metric:
          type: object
          description: Timeseries of the usage quantity. Each point is expressed in
            the unit specified by `unit_name`.
          properties:
            name:
              type: string
            points:
              type: array
              items:
                $ref: '#/components/schemas/scaleway.std.TimeSeries.Point'
            metadata:
              type: object
              properties:
                <metadataKey>:
                  type: string
              additionalProperties: true
          x-properties-order:
          - name
          - points
          - metadata
        project_id:
          type: string
          description: The project ID.
        sku:
          type: string
          description: The SKU of the variant.
        product_name:
          type: string
          description: The product name.
        product_category_id:
          type: string
          description: The product category ID. Corresponds to the product category
            ID in the product catalog tree (e.g. "pc_instance").
        service_category_id:
          type: string
          description: The service category ID. Corresponds to the service category
            ID in the product catalog tree (e.g. "sc_compute").
        unit_name:
          type: string
          description: The unit of measurement for the usage metric, this is a plain
            string and should not be parsed or treated as an enum (e.g. "seconds",
            "gigabyte-seconds").
        locality:
          type: object
          description: The locality of the resource.
          properties:
            global:
              type: boolean
              nullable: true
              x-one-of: locality
            region:
              type: string
              description: The region you want to target
              nullable: true
              x-one-of: locality
            zone:
              type: string
              description: The zone you want to target
              nullable: true
              x-one-of: locality
          x-properties-order:
          - global
          - region
          - zone
      required:
      - impact_co2_metric
      - impact_water_metric
      - usage_metric
      - project_id
      - sku
      - product_name
      - product_category_id
      - service_category_id
      - unit_name
      - locality
      x-properties-order:
      - impact_co2_metric
      - impact_water_metric
      - usage_metric
      - project_id
      - sku
      - product_name
      - product_category_id
      - service_category_id
      - unit_name
      - locality
    scaleway.environmental_impact.v1alpha1.UsageImpactReportAvailability:
      type: object
      properties:
        month_summary_reports:
          type: array
          description: The list of available summary reports covering calendar months.
            (RFC 3339 format)
          example:
          - "2022-03-22T12:34:56.123456Z"
          items:
            $ref: '#/components/schemas/google.protobuf.Timestamp'
        yearly_summary_reports:
          type: array
          description: The list of available summary reports covering calendar years.
            (RFC 3339 format)
          example:
          - "2022-03-22T12:34:56.123456Z"
          items:
            $ref: '#/components/schemas/google.protobuf.Timestamp'
      required:
      - month_summary_reports
      - yearly_summary_reports
      x-properties-order:
      - month_summary_reports
      - yearly_summary_reports
    scaleway.std.File:
      type: object
      properties:
        name:
          type: string
        content_type:
          type: string
        content:
          type: string
      x-properties-order:
      - name
      - content_type
      - content
    scaleway.std.TimeSeries.Point:
      type: array
      items:
        oneOf:
        - type: string
          format: date-time
        - type: number
  securitySchemes:
    scaleway:
      in: header
      name: X-Auth-Token
      type: apiKey
paths:
  /environmental-impact/v1alpha1/organization/enabled:
    get:
      operationId: GetOrganizationEnabled
      parameters:
      - in: query
        name: organization_id
        description: The UUID of the organization.
        required: true
        schema:
          type: string
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.environmental_impact.v1alpha1.GetOrganizationEnabledResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/environmental-impact/v1alpha1/organization/enabled?organization_id=string"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/environmental-impact/v1alpha1/organization/enabled" \
            X-Auth-Token:$SCW_SECRET_KEY \
            organization_id==string
    post:
      operationId: UpdateOrganizationEnabled
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.environmental_impact.v1alpha1.UpdateOrganizationEnabledResponse'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organization_id:
                  type: string
                  description: The UUID of the organization.
                enabled:
                  type: boolean
                  description: Whether to enable or disable the environmental impact
                    feature for the organization.
              required:
              - organization_id
              - enabled
              x-properties-order:
              - organization_id
              - enabled
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{"enabled":false,"organization_id":"string"}' \
            "https://api.scaleway.com/environmental-impact/v1alpha1/organization/enabled"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/environmental-impact/v1alpha1/organization/enabled" \
            X-Auth-Token:$SCW_SECRET_KEY \
            enabled:=false \
            organization_id="string"
  /environmental-impact/v1alpha1/usage/dashboard/metrics:
    get:
      operationId: GetUsageDashboardMetrics
      parameters:
      - in: query
        name: organization_id
        description: The UUID of the organization for which to retrieve impact metrics.
        required: true
        schema:
          type: string
      - in: query
        name: project_id
        description: The UUID of the project for which to retrieve impact metrics.
        schema:
          type: string
      - in: query
        name: start_date
        description: The inclusive start date of the impact metrics. (RFC 3339 format)
        schema:
          type: string
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
      - in: query
        name: end_date
        description: The exclusive end date of the impact metrics, will default to
          now if not set. (RFC 3339 format)
        schema:
          type: string
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.environmental_impact.v1alpha1.UsageDashboardMetrics'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/environmental-impact/v1alpha1/usage/dashboard/metrics?organization_id=string&start_date=2022-03-22T12:34:56.123456Z"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/environmental-impact/v1alpha1/usage/dashboard/metrics" \
            X-Auth-Token:$SCW_SECRET_KEY \
            organization_id==string \
            start_date==2022-03-22T12:34:56.123456Z
  /environmental-impact/v1alpha1/usage/reports/availability:
    get:
      operationId: GetUsageImpactReportAvailability
      summary: Returns the list of available usage reports by date.
      parameters:
      - in: query
        name: organization_id
        required: true
        schema:
          type: string
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.environmental_impact.v1alpha1.UsageImpactReportAvailability'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/environmental-impact/v1alpha1/usage/reports/availability?organization_id=string"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/environmental-impact/v1alpha1/usage/reports/availability" \
            X-Auth-Token:$SCW_SECRET_KEY \
            organization_id==string
  /environmental-impact/v1alpha1/usage/reports/download-month-summary:
    post:
      operationId: DownloadUsageImpactMonthSummaryReport
      summary: Returns a summary report of the estimated environmental impact of the
        requesting organization's use of resources. The report covers the calendar
        month specified in the request.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.std.File'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organization_id:
                  type: string
                  description: The UUID of the organization for which you want to
                    download a report.
                file_type:
                  type: string
                  description: The file type of the report.
                  enum:
                  - unknown_report_file_type
                  - pdf
                  default: unknown_report_file_type
                month_date:
                  type: string
                  description: The first day of the month for which you want to download
                    a report. (ISO 8601 format, e.g. 2025-05-01T00:00:00Z). (RFC 3339
                    format)
                  format: date-time
                  example: "2022-03-22T12:34:56.123456Z"
                  nullable: true
              required:
              - organization_id
              - file_type
              - month_date
              x-properties-order:
              - organization_id
              - file_type
              - month_date
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "file_type": "unknown_report_file_type",
              "month_date": "2022-03-22T12:34:56.123456Z",
              "organization_id": "string"
            }' \
            "https://api.scaleway.com/environmental-impact/v1alpha1/usage/reports/download-month-summary"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/environmental-impact/v1alpha1/usage/reports/download-month-summary" \
            X-Auth-Token:$SCW_SECRET_KEY \
            file_type="unknown_report_file_type" \
            month_date="2022-03-22T12:34:56.123456Z" \
            organization_id="string"
  /environmental-impact/v1alpha1/usage/reports/download-year-summary:
    post:
      operationId: DownloadUsageImpactYearSummaryReport
      summary: Returns a summary report of the estimated environmental impact of the
        requesting organization's use of resources. The report covers the calendar
        year specified in the request.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.std.File'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organization_id:
                  type: string
                  description: The UUID of the organization for which you want to
                    download a report.
                file_type:
                  type: string
                  description: The file type of the report.
                  enum:
                  - unknown_report_file_type
                  - pdf
                  default: unknown_report_file_type
                year_date:
                  type: string
                  description: The first day of the year for which you want to download
                    a report. (ISO 8601 format, e.g. 2025-01-01T00:00:00Z). (RFC 3339
                    format)
                  format: date-time
                  example: "2022-03-22T12:34:56.123456Z"
                  nullable: true
              required:
              - organization_id
              - file_type
              - year_date
              x-properties-order:
              - organization_id
              - file_type
              - year_date
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "file_type": "unknown_report_file_type",
              "organization_id": "string",
              "year_date": "2022-03-22T12:34:56.123456Z"
            }' \
            "https://api.scaleway.com/environmental-impact/v1alpha1/usage/reports/download-year-summary"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/environmental-impact/v1alpha1/usage/reports/download-year-summary" \
            X-Auth-Token:$SCW_SECRET_KEY \
            file_type="unknown_report_file_type" \
            organization_id="string" \
            year_date="2022-03-22T12:34:56.123456Z"
