# Import bills POST https://api-sandbox.payabli.com/api/Import/billsForm/{entry} Content-Type: multipart/form-data Import a list of bills from a CSV file. See the [Import Guide](/developers/developer-guides/bills-add#import-bills) for more help and an example file. Reference: https://docs.payabli.com/developers/api-reference/bill/import-list-of-bills ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Import list of bills version: endpoint_import.ImportBills paths: /Import/billsForm/{entry}: post: operationId: import-bills summary: Import list of bills description: >- Import a list of bills from a CSV file. See the [Import Guide](/developers/developer-guides/bills-add#import-bills) for more help and an example file. tags: - - subpackage_import parameters: - name: entry in: path description: >- The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry) required: true schema: type: string - name: requestToken in: header required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_:PayabliApiResponseImport' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: multipart/form-data: schema: type: object properties: file: type: string format: binary description: >- The file to be imported. The file must be a CSV file with the correct format. See the [Import Guide](/developers/developer-guides/bills-add#import-bills) for more help and example files. required: - file components: schemas: type_:IsSuccess: type: boolean type_:PageIdentifier: type: string type_:Responsecode: type: integer type_:PayabliApiResponseImportResponseData: type: object properties: added: type: integer description: The number of records successfully added. errors: type: array items: type: string description: List of errors, if any. rejected: type: integer description: The number of records that were rejected. type_:ResponseText: type: string type_:PayabliApiResponseImport: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' pageIdentifier: $ref: '#/components/schemas/type_:PageIdentifier' responseCode: $ref: '#/components/schemas/type_:Responsecode' responseData: $ref: '#/components/schemas/type_:PayabliApiResponseImportResponseData' description: The response data containing the result of the import operation. responseText: $ref: '#/components/schemas/type_:ResponseText' required: - responseText ``` ## SDK Code Examples ```python ImportBills from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.import_.import_bills( entry="8cfec329267", ) ``` ```typescript ImportBills import { createReadStream } from "fs"; import * as fs from "fs"; import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.import.importBills("8cfec329267", { file: fs.createReadStream("/path/to/your/file") }); ``` ```go ImportBills import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.Import.ImportBills( context.TODO(), "8cfec329267", &sdkgo.ImportBillsRequest{}, ) ``` ```csharp ImportBills using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.Import.ImportBillsAsync("8cfec329267", new ImportBillsRequest()); ``` ```ruby ImportBills require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Import/billsForm/8cfec329267") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001' request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n" response = http.request(request) puts response.read_body ``` ```java ImportBills HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/Import/billsForm/8cfec329267") .header("requestToken", "") .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001") .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n") .asString(); ``` ```php ImportBills request('POST', 'https://api-sandbox.payabli.com/api/Import/billsForm/8cfec329267', [ 'multipart' => [ [ 'name' => 'file', 'filename' => '', 'contents' => null ] ] 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift ImportBills import Foundation let headers = [ "requestToken": "", "Content-Type": "multipart/form-data; boundary=---011000010111000001101001" ] let parameters = [ [ "name": "file", "fileName": "" ] ] let boundary = "---011000010111000001101001" var body = "" var error: NSError? = nil for param in parameters { let paramName = param["name"]! body += "--\(boundary)\r\n" body += "Content-Disposition:form-data; name=\"\(paramName)\"" if let filename = param["fileName"] { let contentType = param["content-type"]! let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8) if (error != nil) { print(error as Any) } body += "; filename=\"\(filename)\"\r\n" body += "Content-Type: \(contentType)\r\n\r\n" body += fileContent } else if let paramValue = param["value"] { body += "\r\n\r\n\(paramValue)" } } let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Import/billsForm/8cfec329267")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```