---
openapi: 3.0.1
info:
  title: Adra Shared API 1.0
  description: API for sharing common data with the Adra Product Suite.
  version: '1.0'
  contact:
    name: API Support
    url: https://success.adra.com/s/
    email: support@adra.com
  license:
    name: Proprietary License
    url: https://www.trintech.com/terms-and-conditions/adra/
  x-feedbackLink:
    url: https://success.adra.com/s/resources/ideas
    label: Give Feedback
servers:
- url: https://sharedapi.adra.com
  description: Production server
- url: https://sharedapi.adrastage.com
  description: Stage server
- url: https://sharedapi.adratest.com
  description: Test server
- url: https://sharedapi.adradev.com
  description: Dev server
tags:
- name: Legal Entities
  description: |-
    ## Overview
    Legal entities represent the organizational units within an engagement that require separate accounting or reporting. These can include:

    - Subsidiaries
    - Branches
    - Regional offices
    - Operating divisions

    ## Structure
    Each legal entity contains essential information:

    - **Identification**: Unique identifiers and codes
      - Legal Entity ID
      - Legal Entity GUID
      - Legal Entity Code
      - Organization Number

    - **Basic Information**:
      - Legal Entity Name
      - Status (Active/Inactive)

    - **Location Details**:
      - Country Code
      - Address Information
      - City and Postal Code

    - **Financial Settings**:
      - Currency Code
      - Additional Configuration

    ## Usage
    Legal entities are fundamental to:

    - Organizing financial data
    - Managing compliance requirements
    - Structuring reporting hierarchies
    - Maintaining separate books of accounts

    They serve as the foundation for financial consolidation and segregation of business.
externalDocs:
  description: Adra Success Center
  url: https://success.adra.com/s/knowledge-center
paths:
  "/api/v1.0/engagements/{engagementSid}/legal-entities":
    get:
      tags:
      - Public
      summary: Get legal entities by Engagement GUID
      operationId: GetLegalEntitiesByEngagementGuid
      parameters:
      - name: engagementSid
        in: path
        description: Short identifier for engagement (as in URLs)
        required: true
        schema:
          type: string
      - name: "$filter"
        in: query
        description: OData $filter parameter
        schema:
          type: string
      - name: "$orderby"
        in: query
        description: OData $orderby parameter
        schema:
          type: string
      - name: "$top"
        in: query
        description: OData $top parameter
        required: true
        schema:
          maximum: 500
          minimum: 0
          type: integer
          format: int64
      - name: "$skip"
        in: query
        description: OData $skip parameter
        schema:
          maximum: 500
          minimum: 0
          type: integer
          format: int64
      - name: "$count"
        in: query
        description: OData $count parameter
        schema:
          type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/LegalEntityQueryResult"
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                "$ref": "#/components/schemas/ProblemDetails"
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                "$ref": "#/components/schemas/ProblemDetails"
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                "$ref": "#/components/schemas/ProblemDetails"
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                "$ref": "#/components/schemas/ProblemDetails"
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                "$ref": "#/components/schemas/ProblemDetails"
      security:
      - adra_client_credentials:
        - shared_api.public
        adra_personal_access_token:
        - shared_api.public
components:
  schemas:
    LegalEntity:
      required:
      - id
      - engagementId
      - code
      - name
      - countryCode
      - currencyCode
      - active
      type: object
      properties:
        id:
          type: string
          format: uuid
        engagementId:
          type: string
          format: uuid
        code:
          type: string
        name:
          type: string
        countryCode:
          type: string
        currencyCode:
          type: string
        active:
          type: boolean
        organizationNo:
          type: string
          nullable: true
        address1:
          type: string
          nullable: true
        address2:
          type: string
          nullable: true
        postalCode:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        extraInfo:
          type: string
          nullable: true
      additionalProperties: false
    LegalEntityQueryResult:
      type: object
      properties:
        value:
          type: array
          items:
            "$ref": "#/components/schemas/LegalEntity"
        "@odata.count":
          type: string
          nullable: true
        "@odata.nextPage":
          type: string
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: false
  securitySchemes:
    adra_oauth_client_cred:
      type: oauth2
      description: OAuth 2.0 Bearer Client Credentials Scheme
      flows:
        clientCredentials:
          tokenUrl: https://login.adra.com/connect/token
          scopes:
            shared_api.full_access: shared_api.full_access
    adra_personal_access_token:
      type: http
      description: OAuth 2.0 Bearer Reference Token Scheme
      scheme: Bearer
