Altruistiq Security API

The Altruistiq API uses TLS and follows the OAuth 2.0 Client credentials flow as per [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4) ### Generating `client_id` and `client_secret` In order to generate your `client_id` and `client_secret`, go to the altruistiq application’s organisation settings.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

altruistiq-security-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Altruistiq Datasource Security API
  x-logo:
    url: ./aq.svg
    altText: Altruistiq Logo
  version: 1.0.0
  description: '# Definitions


    An **Activity** is a business process that has taken place, which is relevant for emissions measurement. Examples of an **Activity** in Altruistiq’s data model are **ElectricityUse** or **WasteGenerated**.

    A **Calculation Method** is an GHG Protocol compliant method to calculate emissions from Activity data. Calculation Methods have a unique set of data requirements, but are not unique to an **Activity**.

    A **Datasource** is a single data format that your data is shared with Altruistiq in. Alongside this function, a **Datasource** plays the role of linking a data format to key contextual information (e.g. relevant **Facilities**, relevant **Activities**, owner, chosen **Calculation Methods**, status).

    **Datasets** are then individual files ingested via that Datasource. Each **Dataset** has a live status for full data lineage and transparency that you can track in the application.


    # Datasource API Outline


    Primarily, Altruistiq’s Datasource API enables the creation and management of Datasources and the upload of new Datasets. Alongside this there are a number of supporting functions.


    The Datasource API is governed by the oauth2 protocol.


    The Datasource API by default does not expect sudden bursts of data upload (e.g. 25x5GB of data transferred at once), but instead delta datasets. When uploading to the upload endpoint the files uploaded must be chunked into chunks < 100mb and if there are more than 1 part then chunks must be > 5mb (the last part can be below this). If this is not the case for your business, do raise this at your Kick Off call and we will accommodate this.


    # PACT API Outline


    Primarily, Altruistiq’s PACT API allows customers to export Product Carbon Footprint (PCF) data in a PACT conformant way. PACT is the Partnership for Carbon Transparency, a WRI and WBCSD funded NGO that is setting the calculation and technological standard for the exchange for Product Carbon Footprints between businesses. Today, Altruistiq is 1 of ~10 PACT conformant solutions globally.


    The PACT API is is governed by the oauth2 protocol (see Security).


    For full documentation of our PACT API, please go to https://wbcsd.github.io/data-exchange-protocol/v2/#api-examples. This provides the full documentation for product data exports, and the associated data model.'
servers:
- url: https://app.altruistiq.com/
  description: Altruistiq Server
tags:
- name: Security
  description: 'The Altruistiq API uses TLS and follows the OAuth 2.0 Client credentials flow as per [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4)


    ### Generating `client_id` and `client_secret`


    In order to generate your `client_id` and `client_secret`, go to the altruistiq application’s organisation settings.'
paths:
  /api/public/v1/oauth2/token:
    post:
      security:
      - oauth2: []
      tags:
      - Security
      summary: Retrieve An Access Token
      operationId: getOauth2Token
      description: Retrieve an access token which will enable access to private areas of the API
      x-codeSamples:
      - lang: python
        label: Python
        source: "token_req_data = {\n  'grant_type': 'client_credentials',\n  'client_id': client_id,\n  'client_secret': client_secret\n}\ntoken_response = requests.post(\n  \"https://app.altruistiq.com/api/public/v1/oauth2/token\",\n  data=token_req_data\n)\ntoken = token_response.json()['access_token']\n"
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/OauthToken'
      responses:
        '200':
          description: Token Retrieved
          content:
            application/json:
              schema:
                properties:
                  access_token:
                    type: string
                    description: The access token
                  token_type:
                    type: string
                    example: Bearer
                    description: The type of token
                  expires_in:
                    type: integer
                    example: 4000
                    description: Token TTL
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/401'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/500'
components:
  schemas:
    '401':
      type: object
      properties:
        status:
          type: string
          example: Unauthorized
          description: Request was unauthorized
    OauthToken:
      required:
      - client_id
      - client_secret
      - grant_type
      type: object
      properties:
        client_id:
          type: string
          example: client-id-123
          description: The client ID.
        client_secret:
          type: string
          example: client_secret-123
          description: The client secret.
        grant_type:
          type: string
          enum:
          - client_credentials
          example: client_credentials
    '500':
      type: object
      properties:
        status:
          type: string
          example: Server Error
          description: Internal Error
  securitySchemes:
    bearerAuth:
      type: apiKey
      name: Authorization
      in: header
      description: 'Enter the token with the `Bearer: ` prefix, e.g. `Bearer: apiKey`.'
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://app.altruistiq.com/api/public/v1/oauth2/token