diff --git a/specs/general.openapi.yml b/specs/general.openapi.yml index 5248eb1..d08896b 100644 --- a/specs/general.openapi.yml +++ b/specs/general.openapi.yml @@ -84,7 +84,90 @@ tags: x-page-title: Billing x-page-description: Billing information description: Account Billing + + - name: Organizations + x-parent: general-api + x-page-title: Organizations + x-page-description: Organization Sub Accounts management + description: Create and manage organization sub accounts paths: + '/api/organizations/{organization_id}/sub_accounts': + get: + operationId: getOrganizationSubAccounts + summary: Get organization sub accounts + description: Get a list of sub accounts for the specified organization. You must have sub account management permissions for this organization. + tags: + - Organizations + responses: + '200': + description: Returns the list of sub accounts belonging to the organization. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SubAccount' + example: + - id: 12345 + name: Development Team Account + - id: 12346 + name: QA Team Account + '401': + $ref: '#/components/responses/UNAUTHENTICATED' + '403': + $ref: '#/components/responses/PERMISSION_DENIED' + post: + operationId: createOrganizationSubAccount + summary: Create organization sub account + description: Create a new sub account under the specified organization. You must have sub account management permissions for this organization. + tags: + - Organizations + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - account + properties: + account: + type: object + required: + - name + properties: + name: + type: string + description: Name of the sub account to create + example: New Team Account + responses: + '200': + description: Sub account created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/SubAccount' + example: + id: 12347 + name: New Team Account + '400': + description: Bad request - invalid parameters. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '401': + $ref: '#/components/responses/UNAUTHENTICATED' + '403': + $ref: '#/components/responses/PERMISSION_DENIED' + '422': + description: Unprocessable entity - validation errors. + content: + application/json: + schema: + $ref: '#/components/schemas/UnprocessableEntity' + parameters: + - $ref: '#/components/parameters/organization_id' /api/accounts: get: operationId: getAllAccounts @@ -820,6 +903,19 @@ paths: - $ref: '#/components/parameters/account_id' components: schemas: + SubAccount: + title: SubAccount + description: Represents a sub account within an organization + type: object + properties: + id: + type: integer + example: 12345 + description: The unique identifier of the sub account + name: + type: string + example: Development Team Account + description: The name of the sub account AccountAccess: title: AccountAccess description: Assigns resource-specific permissions to a specifier. @@ -954,6 +1050,21 @@ components: type: string description: Error message example: Incorrect API token + ErrorResponse: + title: ErrorResponse + type: object + properties: + errors: + type: string + description: Error message + example: Unexpected error + UnprocessableEntity: + title: UnprocessableEntity + type: object + properties: + errors: + type: object + description: Validation errors per attribute. Entire record errors are under `base` key. securitySchemes: HeaderAuth: type: apiKey @@ -984,6 +1095,16 @@ components: schema: $ref: '#/components/schemas/NotFoundResponse' parameters: + organization_id: + description: Unique organization ID + name: organization_id + in: path + required: true + schema: + type: integer + format: int64 + minimum: 1 + example: 1001 account_id: description: Unique account ID name: account_id