openapi: 3.0.0 info: version: 1.0.19-oas3 title: AlayaCare Accounting Accounts Visit Premiums API description: '**AlayaCare IDs:** The following terms are used to reference IDs that identify resources in AlayaCare: - id - visit_id - premium_id - visit_premium_id - employee_id - cost_centre_id - client_id **External IDs** The following terms are used to reference IDs that identify resources systems external to AlayaCare: - employee_external_id - client_external_id External IDs are required to be unique. No other assumptions are made regarding their format they are treated as strings. ' servers: - url: https://example.alayacare.com/ext/api/v2/accounting security: - basic_auth: [] tags: - name: Visit Premiums paths: /visits/{visit_id}/premiums: parameters: - in: path name: visit_id description: AlayaCare visit ID required: true schema: type: integer minimum: 1 get: tags: - Visit Premiums summary: Get a list of premiums attached to a visit parameters: - in: query name: page description: Filter by page number required: false schema: type: integer default: 1 minimum: 1 - in: query name: count description: Number of items per page required: false schema: type: integer default: 10 responses: '200': description: A list of premiums attached to the visit content: application/json: schema: $ref: '#/components/schemas/VisitPremiumsList' '404': $ref: '#/components/responses/ErrorVisitNotFound' post: tags: - Visit Premiums summary: Create a visit premium requestBody: content: application/json: schema: $ref: '#/components/schemas/VisitPremiumCreateSchema' description: Premium data required: true responses: '201': description: Visit premium created successfully content: application/json: schema: $ref: '#/components/schemas/VisitPremiumDetails' '401': $ref: '#/components/responses/ErrorResponseAuthentication' '404': $ref: '#/components/responses/ErrorVisitNotFound' '409': $ref: '#/components/responses/ErrorResponseVisitPremiumConflict' /visits/{visit_id}/premiums/{visit_premium_id}: parameters: - in: path name: visit_id description: AlayaCare visit ID required: true schema: type: integer minimum: 1 - in: path name: visit_premium_id description: AlayaCare visit premium ID required: true schema: type: integer minimum: 1 get: tags: - Visit Premiums summary: Get the details of a single visit premium responses: '200': description: A visit premium content: application/json: schema: $ref: '#/components/schemas/VisitPremiumDetails' '401': $ref: '#/components/responses/ErrorResponseAuthentication' '404': $ref: '#/components/responses/ErrorVisitNotFound' put: tags: - Visit Premiums summary: Update a visit premium requestBody: content: application/json: schema: $ref: '#/components/schemas/VisitPremiumUpdateSchema' description: Premium data required: true responses: '200': description: Visit premium updated successfully content: application/json: schema: $ref: '#/components/schemas/VisitPremiumDetails' '401': $ref: '#/components/responses/ErrorResponseAuthentication' '404': $ref: '#/components/responses/ErrorVisitNotFound' '409': $ref: '#/components/responses/ErrorResponseVisitPremiumConflict' delete: tags: - Visit Premiums summary: Delete a visit premium from a visit responses: '204': description: Visit premium successfully deleted '401': $ref: '#/components/responses/ErrorResponseAuthentication' '404': $ref: '#/components/responses/ErrorVisitNotFound' components: schemas: PaginatedList: description: Base model of all paginated lists type: object properties: count: type: integer description: Number of items in the response example: 10 page: type: integer description: Current page number example: 1 minimum: 1 total_pages: type: integer description: Total number of pages available example: 1 items: type: array items: type: object required: - count - page - total_pages - items VisitPremiumDetails: description: A visit premium type: object properties: visit_premium_id: type: integer description: AlayaCare visit premium ID example: 345 minimum: 1 description: type: string description: Description of the visit premium example: Reported travel KMs quantity: type: integer description: Quantity of premiums applied to the visit example: 2 premium: $ref: '#/components/schemas/Premium' required: - visit_premium_id - quantity - premium PayCode: description: AlayaCare pay code type: object properties: id: type: integer description: AlayCare pay code ID example: 3 minimum: 1 code: type: string description: AlayCare pay code name example: 783 Premium: description: A premium configured in AlayaCare Accounting Settings type: object properties: code: type: string description: AlayaCare premium code name example: MILEAGE premium_id: type: integer description: AlayaCare premium ID example: 643 minimum: 1 pay_code: $ref: '#/components/schemas/PayCode' bill_codes: type: array items: $ref: '#/components/schemas/BillCode' rule: type: string description: AlayaCare premium rule name example: Weekends branch: $ref: '#/components/schemas/Branch' required: - code - premium_id VisitPremiumsList: allOf: - $ref: '#/components/schemas/PaginatedList' type: object description: Paginated list of premiums properties: items: type: array items: $ref: '#/components/schemas/VisitPremiumDetails' BillCode: description: AlayaCare bill code type: object properties: id: type: integer description: AlayCare bill code ID example: 783 minimum: 1 code: type: string description: AlayCare bill code name example: MEDIBILL required: - id - code VisitPremiumCreateSchema: type: object required: - premium_id - quantity properties: premium_id: type: integer description: AlayaCare premium ID minimum: 1 quantity: type: number example: 1.01 description: type: string example: Mileage KMs override_locked_visit: type: boolean example: false description: 'Flag to override a locked visit. A visit is considered "locked" in AlayaCare when it is included in a billing or payroll run. Only users with the correct permissions enabled may edit a "locked" visit. Note that if a visit is locked and this flag is sent as `true`, your organization may need to re-run billing or payroll in the AlayaCare web application to properly reflect the changes. ' Branch: description: AlayaCare branch type: object properties: id: type: integer description: Branch ID example: 1000 minimum: 1 name: type: string description: Branch name example: AlayaCare Health ErrorResponse: description: Error response type: object properties: code: type: integer example: 400 description: Response code message: type: string example: Invalid request description: Detailed error message required: - code - message VisitPremiumUpdateSchema: type: object properties: premium_id: type: integer description: AlayaCare premium ID minimum: 1 quantity: type: number example: 1.01 description: type: string example: Mileage KMs responses: ErrorResponseAuthentication: description: Authorization required content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: response: value: code: '401' message: Authorization required. ErrorVisitNotFound: description: The visit referenced by visit_id was not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: response: value: code: '404' message: Visit not found ErrorResponseVisitPremiumConflict: description: Conflict content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: response: value: code: '409' message: The funding configuration of this premium does not match that of the visit securitySchemes: basic_auth: type: http description: Basic HTTP auth over https scheme: basic