# Send bill for approval POST https://api-sandbox.payabli.com/api/Bill/approval/{idBill} Content-Type: application/json Send a bill to a user or list of users to approve. Reference: https://docs.payabli.com/developers/api-reference/bill/send-a-bill-to-approval ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Send a bill to approval version: endpoint_bill.SendToApprovalBill paths: /Bill/approval/{idBill}: post: operationId: send-to-approval-bill summary: Send a bill to approval description: Send a bill to a user or list of users to approve. 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: autocreateUser in: query description: >- Automatically create the target user for approval if they don't exist. required: false schema: type: boolean default: false - name: requestToken in: header required: true schema: type: string - name: idempotencyKey in: header required: false schema: $ref: '#/components/schemas/type_:IdempotencyKey' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_bill:BillResponse' '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: application/json: schema: type: array items: type: string components: schemas: type_:IdempotencyKey: type: string type_:Responsecode: type: integer type_:PageIdentifier: type: string type_:RoomIdNotInUse: type: integer format: int64 type_:IsSuccess: type: boolean type_:ResponseText: type: string type_:Responsedatanonobject: oneOf: - type: string - type: integer type_bill:BillResponse: type: object properties: responseCode: $ref: '#/components/schemas/type_:Responsecode' pageIdentifier: $ref: '#/components/schemas/type_:PageIdentifier' roomId: $ref: '#/components/schemas/type_:RoomIdNotInUse' isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseText: $ref: '#/components/schemas/type_:ResponseText' responseData: $ref: '#/components/schemas/type_:Responsedatanonobject' description: >- If `isSuccess` = true, this contains the bill identifier. If `isSuccess` = false, this contains the reason for the error. required: - responseText ``` ## SDK Code Examples ```python SendForApproval from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.bill.send_to_approval_bill( id_bill=285, idempotency_key="6B29FC40-CA47-1067-B31D-00DD010662DA", request=["string"], ) ``` ```typescript SendForApproval import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.bill.sendToApprovalBill(285, { idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA", body: ["string"] }); ``` ```go SendForApproval 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.SendToApprovalBill( context.TODO(), 285, &sdkgo.SendToApprovalBillRequest{ IdempotencyKey: sdkgo.String( "6B29FC40-CA47-1067-B31D-00DD010662DA", ), Body: []string{ "string", }, }, ) ``` ```csharp SendForApproval using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.Bill.SendToApprovalBillAsync( 285, new SendToApprovalBillRequest { IdempotencyKey = "6B29FC40-CA47-1067-B31D-00DD010662DA", Body = new List() { "string" }, } ); ``` ```ruby SendForApproval require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Bill/approval/285") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["idempotencyKey"] = '6B29FC40-CA47-1067-B31D-00DD010662DA' request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "[\n \"string\"\n]" response = http.request(request) puts response.read_body ``` ```java SendForApproval HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/Bill/approval/285") .header("idempotencyKey", "6B29FC40-CA47-1067-B31D-00DD010662DA") .header("requestToken", "") .header("Content-Type", "application/json") .body("[\n \"string\"\n]") .asString(); ``` ```php SendForApproval request('POST', 'https://api-sandbox.payabli.com/api/Bill/approval/285', [ 'body' => '[ "string" ]', 'headers' => [ 'Content-Type' => 'application/json', 'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift SendForApproval import Foundation let headers = [ "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA", "requestToken": "", "Content-Type": "application/json" ] let parameters = ["string"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Bill/approval/285")! 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() ```