# Get bill attachment GET https://api-sandbox.payabli.com/api/Bill/attachedFileFromBill/{idBill}/{filename} Retrieves a file attached to a bill, either as a binary file or as a Base64-encoded string. Reference: https://docs.payabli.com/developers/api-reference/bill/get-attached-file-from-bill ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get attached file from bill version: endpoint_bill.getAttachedFromBill paths: /Bill/attachedFileFromBill/{idBill}/{filename}: get: operationId: get-attached-from-bill summary: Get attached file from bill description: >- Retrieves a file attached to a bill, either as a binary file or as a Base64-encoded string. tags: - - subpackage_bill parameters: - name: idBill in: path description: >- Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. required: true schema: type: integer - name: filename in: path description: >- The filename in Payabli. Filename is `zipName` in response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``. "DocumentsRef": { "zipfile": "inva_269.zip", "filelist": [ { "originalName": "Bill.pdf", "zipName": "0_Bill.pdf", "descriptor": null } ] } required: true schema: type: string - name: returnObject in: query description: >- When `true`, the request returns the file content as a Base64-encoded string. required: false schema: type: boolean default: false - name: requestToken in: header required: true schema: type: string responses: '200': description: >- A successful response returns a binary file when `returnObject` is `false`. When `returnObject` is `true`, the response contains the file content as a Base64-encoded string in an object. Due to technical limitations, only the object response is documented here. content: application/json: schema: $ref: '#/components/schemas/type_:FileContent' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} components: schemas: type_:FileContentFtype: type: string enum: - value: pdf - value: doc - value: docx - value: jpg - value: jpeg - value: png - value: gif - value: txt type_:FileContent: type: object properties: fContent: type: string description: >- Content of file, Base64-encoded. Ignored if furl is specified. Max upload size is 30 MB. filename: type: string description: The name of the attached file. ftype: $ref: '#/components/schemas/type_:FileContentFtype' description: The MIME type of the file (if content is provided) furl: type: string description: Optional URL provided to show or download the file remotely ``` ## SDK Code Examples ```python GetAttachedFile from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.bill.get_attached_from_bill( filename="0_Bill.pdf", id_bill=285, return_object=True, ) ``` ```typescript GetAttachedFile import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.bill.getAttachedFromBill(285, "0_Bill.pdf", { returnObject: true }); ``` ```go GetAttachedFile 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.Bill.GetAttachedFromBill( context.TODO(), "0_Bill.pdf", 285, &sdkgo.GetAttachedFromBillRequest{ ReturnObject: sdkgo.Bool( true, ), }, ) ``` ```csharp GetAttachedFile using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.Bill.GetAttachedFromBillAsync( "0_Bill.pdf", 285, new GetAttachedFromBillRequest { ReturnObject = true } ); ``` ```ruby GetAttachedFile require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Bill/attachedFileFromBill/285/0_Bill.pdf?returnObject=true") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["requestToken"] = '' response = http.request(request) puts response.read_body ``` ```java GetAttachedFile HttpResponse response = Unirest.get("https://api-sandbox.payabli.com/api/Bill/attachedFileFromBill/285/0_Bill.pdf?returnObject=true") .header("requestToken", "") .asString(); ``` ```php GetAttachedFile request('GET', 'https://api-sandbox.payabli.com/api/Bill/attachedFileFromBill/285/0_Bill.pdf?returnObject=true', [ 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift GetAttachedFile import Foundation let headers = ["requestToken": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Bill/attachedFileFromBill/285/0_Bill.pdf?returnObject=true")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```