{"openapi":"3.1.0","info":{"description":"Batch API","title":"Batch API","version":"1.0.0"},"servers":[{"url":"http://localhost:8080/batch-api"}],"tags":[{"description":"Set of APIs related to managing batch data","name":"Batch API"}],"paths":{"/batches":{"get":{"description":"Retrieves all batches by type and provided matching statuses.","operationId":"getBatches","parameters":[{"description":"Offset used for paging results","in":"query","name":"offset","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"description":"List fetch limit, value between 1 and 1000","in":"query","name":"limit","required":false,"schema":{"type":"integer","format":"int32","default":100,"maximum":1000,"minimum":1}},{"description":"List of BatchStatus types - Optional","in":"query","name":"statuses","required":false,"schema":{"type":["array","null"],"default":[],"items":{"type":"string","enum":["RECEIVED","PROCESSING","COMPLETED"]}}},{"description":"Batch type - Optional","in":"query","name":"type","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BatchResponse"}}}},"description":"Success"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unprocessable Content"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get batches","tags":["Batch API"]},"post":{"description":"Creates a batch to be processed.","operationId":"createBatch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBatchRequestBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBatchResponseBody"}}},"description":"Success"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unprocessable Content"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Creates a batch","tags":["Batch API"]}},"/batches/{batchId}/items":{"get":{"description":"Retrieves all batch items by given id and provided matching statuses.","operationId":"getBatchItems","parameters":[{"description":"Offset used for paging results","in":"query","name":"offset","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"description":"List fetch limit, value between 1 and 1000","in":"query","name":"limit","required":false,"schema":{"type":"integer","format":"int32","default":100,"maximum":1000,"minimum":1}},{"description":"List of BatchItem statuses - Optional","in":"query","name":"status","required":false,"schema":{"type":["array","null"],"default":[],"items":{"type":"string","enum":["PENDING","SUCCESS","FAILED","ERROR"]}}},{"description":"Unique identifier (UUID) of the Batch","in":"path","name":"batchId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BatchItemResponse"}}}},"description":"Success"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unprocessable Content"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get batch items","tags":["Batch API"]}}},"components":{"schemas":{"BatchItemResponse":{"type":"object","description":"Batch response object, containing batch details","properties":{"createdAtUtc":{"type":"string","format":"date-time","description":"The created timestamp","example":"2025-02-17T11:03:00.461074"},"id":{"type":"string","format":"uuid","description":"Unique identifier (UUID) of the batch-item","example":"30b1ed2a-0f85-4721-8fd9-fafdf658bbb9"},"input":{"type":"object","description":"The input data of the batch-item","example":{"accountId":"0185fa30-eb6c-49e9-9044-a9b757a952a1"}},"output":{"type":"object","description":"The output data of the batch-item","example":{"outcome":"ACCEPTED","transactionId":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"payload":{"type":"object","description":"The payload data of the batch-item","example":{"amount":0.09,"category":"EATING OUT","description":"lunch","transferType":"INTERNAL","internalTransfer":{"senderName":"sender name","recipientName":"recipient name","recipientAccountHayId":"2dff9644-8930-4024-8b94-51d41c7d0d74"},"senderCustomerHayId":"7cf89b43-8bf9-4b7f-9907-e4b0c70e6bed"}},"status":{"type":"string","description":"The current status of the batch-item","enum":["PENDING","SUCCESS","FAILED","ERROR"],"example":"PENDING"}}},"BatchResponse":{"type":"object","description":"Batch response object, containing batch details","properties":{"finishedAtUtc":{"type":"string","format":"date-time","description":"The completed/finished batch timestamp","example":"2025-02-18T11:04:00.872065"},"id":{"type":"string","format":"uuid","description":"Unique identifier (UUID) of the batch","example":"f4bdd9e6-3060-4b81-af6b-015da52602c0"},"receivedAtUtc":{"type":"string","format":"date-time","description":"The latest received timestamp","example":"2025-02-17T11:03:00.461074"},"status":{"type":"string","description":"Current batch status","enum":["RECEIVED","PROCESSING","COMPLETED"],"example":"RECEIVED"},"traceId":{"type":"string","format":"uuid","description":"Unique identifier (UUID) for tracing the batch","example":"30b1ed2a-0f85-4721-8fd9-fafdf658bbb9"},"type":{"type":"string","description":"Enum representing the type of batch","example":"ACCOUNT_TRANSFER"}}},"CreateBatchRequestBody":{"type":"object","description":"Request details of the batch to be created","properties":{"idempotencyKey":{"type":"string","format":"uuid","description":"Unique identifier (UUID) of the Batch idempotency-key","example":"b2edb28b-9a31-411e-9424-0583de2e902a"},"items":{"type":"array","description":"List of batch-items associated to the batch","items":{"$ref":"#/components/schemas/ItemRequest"}},"type":{"type":"string","description":"Type of batch to create","example":"ACCOUNT_TRANSFER"}},"required":["idempotencyKey","items","type"]},"CreateBatchResponseBody":{"type":"object","description":"Details for the created batch","properties":{"finishedAtUtc":{"type":"string","format":"date-time","description":"Timestamp representing when the batch was processed and completed","example":"2025-02-18T11:04:00.872065"},"id":{"type":"string","format":"uuid","description":"Unique identifier (UUID) of the Batch","example":"f4bdd9e6-3060-4b81-af6b-015da52602c0"},"receivedAtUtc":{"type":"string","format":"date-time","description":"Timestamp representing when the batch was created/received","example":"2025-02-17T11:03:00.461074"},"status":{"type":"string","description":"Current status of the batch","enum":["RECEIVED","PROCESSING","COMPLETED"],"example":"RECEIVED"},"traceId":{"type":"string","format":"uuid","description":"TraceId correlated to the batch","example":"30b1ed2a-0f85-4721-8fd9-fafdf658bbb9"},"type":{"type":"string","description":"Type of batch","example":"ACCOUNT_TRANSFER"}},"required":["finishedAtUtc","id","receivedAtUtc","status","traceId","type"]},"ErrorResponse":{"type":"object","description":"An error response.","properties":{"details":{"type":"string","description":"Error details"},"message":{"type":"string","description":"Error description"},"status":{"type":"string","description":"HTTP response status"},"traceId":{"type":"string","description":"TraceID that can be used by HAY for troubleshooting the request"}}},"ItemRequest":{"type":"object","description":"Batch-Item details","properties":{"input":{"type":"object","description":"The input data for the batch-item","example":{"accountId":"0185fa30-eb6c-49e9-9044-a9b757a952a1"}},"payload":{"type":"object","description":"The payload data for the batch-item","example":{"amount":0.09,"transferType":"INTERNAL","internalTransfer":{"recipientAccountHayId":"2dff9644-8930-4024-8b94-51d41c7d0d74","recipientName":"recipient name","senderName":"sender name"},"senderCustomerHayId":"7cf89b43-8bf9-4b7f-9907-e4b0c70e6bed","description":"lunch","category":"EATING OUT"}}},"required":["input","payload"]}},"securitySchemes":{"bearer-key":{"bearerFormat":"JWT","scheme":"bearer","type":"http"}}}}