
{
    "swagger": "2.0",
    "info": {
        "version": "1.0.0",
        "title": "InvoiceIntegrationResource"
    },
    "host": "api.onvio.com.br",
    "basePath": "/dominio/invoice/v2",
    "tags": [
        {
            "name": "Batch"
        }
    ],
    "paths": {
        "/batches": {
            "post": {
                "tags": [
                    "Batch"
                ],
                "summary": "Creates a batch of files to be processed.",
                "description": "",
                "operationId": "createBatch",
                "consumes": [
                    "multipart/form-data"
                ],
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "onvio-client-id",
                        "in": "header",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "name": "onvio-partner-id",
                        "in": "header",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "name": "query",
                        "in": "formData",
                        "description": "JSON Payload",
                        "required": true,
                        "type": "string",
                        "x-example": "{\"boxeFile\": false}"
                    },
                    {
                        "name": "file[]",
                        "in": "formData",
                        "description": "XML File",
                        "required": true,
                        "type": "file"
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "AUTH0 access token",
                        "required": true,
                        "type": "string",
                        "default": "Bearer <access token>"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Successfully created."
                    },
                    "400": {
                        "description": "Invalid data on request."
                    },
                    "401": {
                        "description": "Invalid access token."
                    },
                    "404": {
                        "description": "Not found data."
                    },
                    "500": {
                        "description": "Unexpected error on server."
                    }
                }
            }
        },
        "/batches/{id}": {
            "get": {
                "tags": [
                    "Batch"
                ],
                "summary": "Retrieves a batch of files.",
                "description": "",
                "operationId": "getBatch",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "onvio-client-id",
                        "in": "header",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "name": "onvio-partner-id",
                        "in": "header",
                        "required": false,
                        "type": "string"
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "AUTH0 access token",
                        "required": true,
                        "type": "string",
                        "default": "Bearer <access token>"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful operation",
                        "schema": {
                            "$ref": "#/definitions/BatchV2Dto"
                        }
                    },
                    "400": {
                        "description": "Invalid data on request."
                    },
                    "401": {
                        "description": "Invalid access token."
                    },
                    "404": {
                        "description": "Not found data."
                    },
                    "500": {
                        "description": "Unexpected error on server."
                    }
                }
            }
        }
    },
    "definitions": {
        "BatchV2Dto": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "A globally unique string used to reference the object. This value is assigned by the server and ignored (if present) on Posts."
                },
                "apiVersion": {
                    "type": "string",
                    "description": "Represents the desired version of the service API in a request, and the version of the service API that's served in the response."
                },
                "boxeFile": {
                    "type": "boolean",
                    "description": "Whether should be sent to BOX-e"
                },
                "filesExpanded": {
                    "type": "array",
                    "description": "Files in the batch",
                    "items": {
                        "$ref": "#/definitions/FileV2Dto"
                    }
                },
                "status": {
                    "description": "Current batch status",
                    "$ref": "#/definitions/StatusV2Dto"
                },
                "lastStatusOn": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Latest update of batch status"
                }
            }
        },
        "FileV2Dto": {
            "type": "object",
            "properties": {
                "apiStatus": {
                    "description": "Current API status",
                    "$ref": "#/definitions/StatusV2Dto"
                },
                "boxeStatus": {
                    "description": "Current BOX-e status",
                    "$ref": "#/definitions/StatusV2Dto"
                },
                "lastApiStatusOn": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Latest update of API status"
                },
                "lastBoxeStatusOn": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Latest update of BOX-e status"
                }
            }
        },
        "StatusV2Dto": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string",
                    "description": "Code of status"
                },
                "message": {
                    "type": "string",
                    "description": "Description of status"
                }
            }
        }
    }
}