> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.invoice-api.xhub.io/api-reference/invoices/embed-upload/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.invoice-api.xhub.io/_mcp/server. # Embed a generated e-invoice XML into YOUR carrier PDF (binary upload) POST https://service.invoice-api.xhub.io/api/v1/invoice/{countryCode}/{format}/embed/upload Content-Type: multipart/form-data Same as `/{countryCode}/{format}/embed`, but the carrier PDF is uploaded as a **file part** of a `multipart/form-data` request instead of base64 inside JSON — no base64 overhead on your side or ours. Parts: `pdf` (file), `invoice` (JSON text), optional `validate` (`true`/`false`) and optional `formatOptions` (JSON text). Same checks, same entitlement, same billing and the same JSON response as the JSON route. **Binary response.** Send `Accept: application/pdf` to get the hybrid PDF itself as the response body — but only when there is nothing to report: the check passed (or was not requested), `warnings` is empty and `carrier.warnings` is empty. Otherwise the answer is the JSON body, so a finding is never lost. The binary answer carries the headers `X-Validation-Status` (`passed` or `skipped`), `X-Result-Rechecked` (`true` or `false`), `X-Hash` (SHA-256 of the returned PDF) and `X-Payload-Hash` (the same `payloadHash` as in JSON). Limits: the request body may be up to 96 MiB. The carrier PDF may be up to 64 MiB when the embedding service is available on the server; otherwise it has the same limit as at the JSON route (15 MiB by default). **Large carriers.** Carriers of 5 MiB and more are embedded in a separate service that appends the XML to your file (your bytes stay unchanged). Above 15 MiB the result is not opened again: `warnings` carries `PDF_RESULT_NOT_RECHECKED`, `carrier.checks` is empty and the binary answer has `X-Result-Rechecked: false` — this describes the way, not the document, and does not block the binary answer. If the service is not available and the carrier is larger than 15 MiB, the answer is 503 `EMBED_UNAVAILABLE` with `Retry-After: 60`, and nothing is billed. ⚪ **PDF/A-3 is declared, not converted** — as at the JSON route. A carrier whose fonts could not be checked gets `CARRIER_FONTS_NOT_CHECKED` in `carrier.warnings`. Reference: https://docs.invoice-api.xhub.io/api-reference/invoices/embed-upload ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `countryCode` (enum, required) — Country of the hybrid format (DE, CH, FR, BE) - Allowed values: `DE`, `CH`, `FR`, `BE` - `format` (enum, required) — Hybrid format token - Allowed values: `facturx`, `zugferd` ### Body (multipart/form-data) This endpoint expects a multipart form containing a file. - `pdf` (file, required) — The carrier PDF as a file part (`application/pdf`) — **your** layout, sent as binary instead of base64. It becomes the visual page of the hybrid document; the generated CII XML is embedded into it as `factur-x.xml`. PDF/A-3 is **declared, not converted** — the marker is set on the carrier you sent, the carrier itself is not rewritten. What we actually measured is reported in `carrier`; nothing is rejected because of it. A full PDF/A-3b proof (veraPDF) does not take place. - `invoice` (string, required) — The invoice data as JSON text (content type `application/json`) — the same object as `invoice` at `/{countryCode}/{format}/embed`, checked by the same rules. - `validate` (enum, optional) — `true` runs the same XSD + Schematron check as `/validate` and counts as 2 units — same rule as the JSON route. Omitted or `false`: no check, 1 unit. - `enforcePending` (enum, optional) — `true` rejects findings still in their warning phase (422) — same switch as `enforcePending` at the JSON route. Omitted or `false`: warning phase on. - `formatOptions` (string, optional) — Optional JSON text (content type `application/json`) with `profile` and/or `version` — the same strict object as at the JSON route. `template`/`templateId` are rejected. ## Response ### 200 Hybrid document produced. JSON (same body as the JSON route) by default; the PDF itself with `Accept: application/pdf` when there is no finding. - File download. ## Errors ### 400 Embed Upload Invoices Request Bad Request Error Bad Request — as at the JSON route, plus: the body is not `multipart/form-data`, the `pdf` part is missing or not a file, or `invoice`/`formatOptions` is not valid JSON. A field that breaks the schema returns the same validation body as the JSON route. - `error` (string, required) — Error code - `message` (string, required) — Human-readable error message - `code` (string, optional) — Machine-readable reason, where one exists — e.g. `UNSUPPORTED_FORMAT_VERSION`, `UNSUPPORTED_FORMAT_PROFILE`, `CONFLICTING_FORMAT_OPTIONS` - `field` (string, optional) — The request field the error refers to, where one exists ### 401 Embed Upload Invoices Request Unauthorized Error Unauthorized - `error` (string, required) — Error code - `message` (string, required) — Human-readable error message - `code` (string, optional) — Machine-readable reason, where one exists — e.g. `UNSUPPORTED_FORMAT_VERSION`, `UNSUPPORTED_FORMAT_PROFILE`, `CONFLICTING_FORMAT_OPTIONS` - `field` (string, optional) — The request field the error refers to, where one exists ### 403 Embed Upload Invoices Request Forbidden Error Forbidden — missing entitlement - `error` (string, required) — Error code - `message` (string, required) — Human-readable error message - `code` (string, optional) — Machine-readable reason, where one exists — e.g. `UNSUPPORTED_FORMAT_VERSION`, `UNSUPPORTED_FORMAT_PROFILE`, `CONFLICTING_FORMAT_OPTIONS` - `field` (string, optional) — The request field the error refers to, where one exists ### 413 Embed Upload Invoices Request Content Too Large Error The request body exceeds 96 MiB (`PAYLOAD_TOO_LARGE`, `limit` in bytes) or the carrier PDF exceeds the configured carrier limit (`CARRIER_TOO_LARGE`). - `error` (string, required) — Error code - `message` (string, required) — Human-readable error message - `code` (string, optional) — Machine-readable reason, where one exists — e.g. `UNSUPPORTED_FORMAT_VERSION`, `UNSUPPORTED_FORMAT_PROFILE`, `CONFLICTING_FORMAT_OPTIONS` - `field` (string, optional) — The request field the error refers to, where one exists ### 422 Embed Upload Invoices Request Unprocessable Entity Error The invoice data cannot be turned into a conforming e-invoice — always JSON, same body as the JSON route, without `data`. - `success` (boolean, required) — Whether the hybrid document was produced - `format` (string, required) — Output format used - `filename` (string, required) — Suggested filename - `mimeType` (string, required) — MIME type - `hash` (string, required) — Hex-encoded SHA-256 of the returned document bytes. Not stable across calls (the PDF carries a creation timestamp); use `payloadHash` for idempotent names. - `data` (string, required) — Base64-encoded hybrid PDF: YOUR layout with the generated XML embedded - `payloadHash` (string, optional) — Hex-encoded SHA-256 of the canonical JSON of the `invoice` you sent. - `embeddedXml` (string, optional) — The CII XML that was embedded, for convenient inspection - `carrier` (UnprocessableEntityErrorBodyCarrier, optional) — What we measured on the document we produced from your carrier - `validation` (UnprocessableEntityErrorBodyValidation, optional) — Spec-conformance verdict — present only when the request set `validate: true`. - `appliedFormatOptions` (AppliedFormatOptions, optional) — The ZUGFeRD / Factur-X version and profile the document was actually written in — the requested ones, or the defaults (`2.4` / `1.08`, `EN16931`) when none was sent. Absent for formats without a version selector (XRechnung, UBL, …). - `errors` (list of UnprocessableEntityErrorBodyErrorsItem, optional) — Generation errors (if any) - `complianceErrors` (list of UnprocessableEntityErrorBodyComplianceErrorsItem, optional) — Spec violations found in the generated XML (422) - `warnings` (list of UnprocessableEntityErrorBodyWarningsItem, optional) — Generation warnings (if any). `SELF_CHECK_INCOMPLETE` means a rulebook of our conformance self-check could not be applied: the document was not fully checked against it.`SPEC_RULE_PENDING` means a newly enforced rule found something that is still in its warning phase: the document is returned, and from `enforceFrom` the same finding answers 422 (`specId` names the rulebook; `pendingKey` replaces `rule` when the finding has no rule identifier). Set `enforcePending: true` to be rejected right away. `FIELD_TOO_LONG` means a seller or buyer address field is longer than its limit (`field`, `maximum`); the value was written unchanged, a later release rejects it with 400. `INVOICE_LINES_ABOVE_MODE_LIMIT` means the invoice has more lines including sub-items (`count`) than this server accepts (`limit`); the document is unchanged, a later release rejects it with 400. `PDF_RESULT_NOT_RECHECKED` means the XML was embedded by our embedding service into a carrier larger than 15 MiB and the result was not opened again (`carrier.checks` is empty); it describes the way, not the document. `CARRIER_SIGNATURE_INVALIDATED` means your carrier was signed and had to be embedded locally, so the signature is no longer valid; `CARRIER_CERTIFICATION_INVALIDATED` means your carrier was certified, and any attachment breaks a certification. ### 429 Embed Upload Invoices Request Too Many Requests Error Quota exceeded - `error` (enum, required) — Error code - Allowed values: `QUOTA_EXCEEDED` - `message` (string, required) — Error message - `quota` (TooManyRequestsErrorBodyQuota, required) ### 500 Embed Upload Invoices Request Internal Server Error Internal Server Error - `error` (string, required) — Error code - `message` (string, required) — Human-readable error message - `code` (string, optional) — Machine-readable reason, where one exists — e.g. `UNSUPPORTED_FORMAT_VERSION`, `UNSUPPORTED_FORMAT_PROFILE`, `CONFLICTING_FORMAT_OPTIONS` - `field` (string, optional) — The request field the error refers to, where one exists ### 503 Embed Upload Invoices Request Service Unavailable Error `EMBED_UNAVAILABLE` — the embedding service is not available and the carrier PDF is larger than 15 MiB. `Retry-After: 60`; nothing is billed. Try again later. - `error` (string, required) — Error code - `message` (string, required) — Human-readable error message - `code` (string, optional) — Machine-readable reason, where one exists — e.g. `UNSUPPORTED_FORMAT_VERSION`, `UNSUPPORTED_FORMAT_PROFILE`, `CONFLICTING_FORMAT_OPTIONS` - `field` (string, optional) — The request field the error refers to, where one exists ## Types ### UnprocessableEntityErrorBodyCarrier What we measured on the document we produced from your carrier - `pdfA3Declared` (boolean, required) — 🔴 True means **we set the PDF/A-3 marker** on your carrier (XMP `pdfaid:part=3`, conformance B, sRGB OutputIntent) — it does NOT mean veraPDF says yes. PDF/A-3 is **declared, not converted** — the marker is set on the carrier you sent, the carrier itself is not rewritten. What we actually measured is reported in `carrier`; nothing is rejected because of it. A full PDF/A-3b proof (veraPDF) does not take place. - `checks` (list of UnprocessableEntityErrorBodyCarrierChecksItem, required) — The structure/XMP checks we ran on the produced document (house validator, no external PDF/A conformance tool). Empty when the result was not opened again (`PDF_RESULT_NOT_RECHECKED` in `warnings`). - `warnings` (list of UnprocessableEntityErrorBodyCarrierWarningsItem, required) — Findings about the carrier you sent that we report but do not reject on — e.g. `CARRIER_FONTS_NOT_EMBEDDED` when a font in your PDF has no embedded font file. A PDF/A-3 document is required to embed its fonts; the decision what to do about it is yours. ### UnprocessableEntityErrorBodyValidation Spec-conformance verdict — present only when the request set `validate: true`. - `valid` (boolean, required, nullable) — `true` when every checked format passed XSD + Schematron without findings, `false` when a check found something, `null` when a rulebook did not run (`status: not_run`). - `results` (list of UnprocessableEntityErrorBodyValidationResultsItem, required) — One entry per checked spec format, each with its own verdict and findings - `status` (enum, required) — `passed` — the rulebook ran and found nothing; `failed` — it found something (`valid: false`, see `errors`); `not_run` — it did not run (completely): `valid` is `null` and `reason` says why. A finding beats `not_run`: a real finding with another rulebook not run is `failed`. - Allowed values: `passed`, `failed`, `not_run` - `errors` (list of UnprocessableEntityErrorBodyValidationErrorsItem, optional) — Flattened findings across all checked formats. Absent when there are none. - `reason` (enum, optional) — Why the check did not run: rulebook `missing` (we have no pinned rulebook for this format — a retry gives the same answer), `load-failed`, `transform-failed`, or `not-bound` (no rulebook is bound to the written version/profile). Only with `status: 'not_run'`. - Allowed values: `missing`, `load-failed`, `transform-failed`, `not-bound` ### AppliedFormatOptions The ZUGFeRD / Factur-X version and profile the document was actually written in — the requested ones, or the defaults (`2.4` / `1.08`, `EN16931`) when none was sent. Absent for formats without a version selector (XRechnung, UBL, …). - `version` (enum, required) — Version written (the selectable value — patch releases are included) - Allowed values: `1.0`, `1.07`, `1.08`, `1.09`, `2.3`, `2.4`, `2.5` - `profile` (enum, required) — Profile written - Allowed values: `MINIMUM`, `BASIC WL`, `BASIC`, `EN16931`, `EXTENDED`, `XRECHNUNG` ### UnprocessableEntityErrorBodyErrorsItem - `code` (string, required) — Rule identifier of the finding (Schematron rule ID, `XSD-ERROR`, …) - `message` (string, required) — Human-readable finding text - `enforceFrom` (string, optional) — A finding still in its warning phase (`SPEC_RULE_PENDING` in `warnings`): the date (`YYYY-MM-DD`, UTC) from which it is rejected with 422. It is listed here as an error all the same — the document is not conformant. - `pendingKey` (string, optional) — With `enforceFrom`, when the finding carries no rule identifier: its technical key (not a rule identifier). ### UnprocessableEntityErrorBodyComplianceErrorsItem - `code` (UnprocessableEntityErrorBodyComplianceErrorsItemCode, required) — Stable house code identifying the check (e.g. `DE_SELLER_CITY_001`, `NL_PAYMENT_MEANS_REQUIRED`, or `SPEC_RULE_FAILED` when a conformance gate objected). Never a standard rule identifier — look those up in `rule`. Safe to match on: it does not change when a rule is re-identified. - `message` (string, required) — Error message - `rule` (string, optional) — Identifier of the standard rule this finding violates (e.g. `BR-06`, `BR-DE-5`, `PEPPOL-EN16931-R008`), as published in EN 16931, Peppol BIS or the national CIUS. Present only when a pinned rulebook actually carries that rule and it governs this very check — so you can look it up and read the same statement. Absent means no standard rule covers this finding; the check is then ours alone and `code` names it. - `field` (string, optional) — Field path (if applicable) - `enforceFrom` (string, optional) — Only on a `SPEC_RULE_PENDING` warning: the date (`YYYY-MM-DD`, UTC) from which this finding is rejected with 422. Until then the document is still returned with 200. - `specId` (string, optional) — Only on a `SPEC_RULE_PENDING` warning: the rulebook the newly enforced rule belongs to (e.g. `en16931-3.0.2-ubl`, `factur-x-1.08-extended`). - `pendingKey` (string, optional) — Only on a `SPEC_RULE_PENDING` warning whose finding carries no standard rule identifier: a technical key of the finding (not a rule identifier — do not look it up in a rulebook). Stable, so you can recognise the same finding again. Absent when `rule` is present. ### UnprocessableEntityErrorBodyWarningsItem - `code` (UnprocessableEntityErrorBodyWarningsItemCode, required) — Stable house code identifying the check (e.g. `DE_SELLER_CITY_001`, `NL_PAYMENT_MEANS_REQUIRED`, or `SPEC_RULE_FAILED` when a conformance gate objected). Never a standard rule identifier — look those up in `rule`. Safe to match on: it does not change when a rule is re-identified. - `message` (string, required) — Error message - `rule` (string, optional) — Identifier of the standard rule this finding violates (e.g. `BR-06`, `BR-DE-5`, `PEPPOL-EN16931-R008`), as published in EN 16931, Peppol BIS or the national CIUS. Present only when a pinned rulebook actually carries that rule and it governs this very check — so you can look it up and read the same statement. Absent means no standard rule covers this finding; the check is then ours alone and `code` names it. - `field` (string, optional) — Field path (if applicable) - `enforceFrom` (string, optional) — Only on a `SPEC_RULE_PENDING` warning: the date (`YYYY-MM-DD`, UTC) from which this finding is rejected with 422. Until then the document is still returned with 200. - `specId` (string, optional) — Only on a `SPEC_RULE_PENDING` warning: the rulebook the newly enforced rule belongs to (e.g. `en16931-3.0.2-ubl`, `factur-x-1.08-extended`). - `pendingKey` (string, optional) — Only on a `SPEC_RULE_PENDING` warning whose finding carries no standard rule identifier: a technical key of the finding (not a rule identifier — do not look it up in a rulebook). Stable, so you can recognise the same finding again. Absent when `rule` is present. ### TooManyRequestsErrorBodyQuota - `current` (double, required) — Current usage count - `limit` (double, required) — Usage limit - `period` (string, optional) — Quota period type of the plan quota that was hit, when the rejection carries one ('monthly', 'yearly', ...). Absent whenever the rejection has no period at all — for example a lapsed subscription, where the limit is 0 and no plan quota was involved. This is a period TYPE, never a calendar label such as "2026-03". ### UnprocessableEntityErrorBodyCarrierChecksItem - `code` (string, required) — Stable check code, e.g. 'PDF-001', 'XMP-003', 'CARRIER_FONTS_NOT_EMBEDDED' - `severity` (enum, required) — Severity of the check - Allowed values: `warning`, `error`, `fatal` - `passed` (boolean, required) — Whether the check passed on the produced document - `message` (string, optional) — Human-readable finding, present when it has one ### UnprocessableEntityErrorBodyCarrierWarningsItem - `code` (string, required) — Stable warning code, e.g. 'CARRIER_FONTS_NOT_EMBEDDED' - `message` (string, required) — What we found and what it means for you ### UnprocessableEntityErrorBodyValidationResultsItem - `format` (string, required) — Spec format-id that was validated (e.g. zugferd-2.4-en16931) - `valid` (boolean, required, nullable) — Whether the generated XML passed XSD + Schematron: `true` passed, `false` failed, `null` when the rulebook did not run (then the check says nothing about the document). - `errors` (list of UnprocessableEntityErrorBodyValidationResultsItemErrorsItem, required) — XSD structural + Schematron business-rule findings - `skipped` (string, optional) — Present only when this format was NOT checked. `not entitled` means the API key holds no `create` entitlement for the format; `valid` is then `false` in the sense of "not proven valid", not "failed a rule". ### UnprocessableEntityErrorBodyValidationErrorsItem - `code` (string, required) — Rule identifier of the finding (Schematron rule ID, `XSD-ERROR`, …) - `message` (string, required) — Human-readable finding text - `enforceFrom` (string, optional) — A finding still in its warning phase (`SPEC_RULE_PENDING` in `warnings`): the date (`YYYY-MM-DD`, UTC) from which it is rejected with 422. It is listed here as an error all the same — the document is not conformant. - `pendingKey` (string, optional) — With `enforceFrom`, when the finding carries no rule identifier: its technical key (not a rule identifier). ### UnprocessableEntityErrorBodyComplianceErrorsItemCode Stable house code identifying the check (e.g. `DE_SELLER_CITY_001`, `NL_PAYMENT_MEANS_REQUIRED`, or `SPEC_RULE_FAILED` when a conformance gate objected). Never a standard rule identifier — look those up in `rule`. Safe to match on: it does not change when a rule is re-identified. ### UnprocessableEntityErrorBodyWarningsItemCode Stable house code identifying the check (e.g. `DE_SELLER_CITY_001`, `NL_PAYMENT_MEANS_REQUIRED`, or `SPEC_RULE_FAILED` when a conformance gate objected). Never a standard rule identifier — look those up in `rule`. Safe to match on: it does not change when a rule is re-identified. ### UnprocessableEntityErrorBodyValidationResultsItemErrorsItem - `ruleId` (string, required) — Rule identifier of the finding — a Schematron rule ID (e.g. BR-DE-6, PEPPOL-EN16931-R010), `XSD-ERROR` for a structural schema violation, or `VAL-SYS-005` when the generator/validator threw before any rule fired. A Schematron check without its own ID carries one of our identifiers instead: `SCHEMATRON_ASSERT_WITHOUT_ID` (a failed assert), `SCHEMATRON_REPORT_WITHOUT_ID` (a fired report) or `RULE_ID_MISSING` (the rulebook gave an empty ID). The message then carries the rulebook text. `UNKNOWN` is no longer used. - `message` (string, required) — Human-readable finding text ## Examples **Request** ```json { "pdf": ">", "invoice": "string" } ``` **SDK Code** ```python import requests url = "https://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload" files = { "pdf": "open('', 'rb')" } payload = { "invoice": "string", "validate": , "enforcePending": , "formatOptions": } headers = {"Authorization": "Bearer "} response = requests.post(url, data=payload, files=files, headers=headers) print(response.json()) ``` ```javascript const url = 'https://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload'; const form = new FormData(); form.append('pdf', ''); form.append('invoice', 'string'); form.append('validate', ''); form.append('enforcePending', ''); form.append('formatOptions', ''); const options = {method: 'POST', headers: {Authorization: 'Bearer '}}; options.body = form; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload" payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pdf\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"invoice\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"validate\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enforcePending\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"formatOptions\"\r\n\r\n\r\n-----011000010111000001101001--\r\n") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pdf\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"invoice\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"validate\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enforcePending\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"formatOptions\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload") .header("Authorization", "Bearer ") .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pdf\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"invoice\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"validate\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enforcePending\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"formatOptions\"\r\n\r\n\r\n-----011000010111000001101001--\r\n") .asString(); ``` ```php request('POST', 'https://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload', [ 'multipart' => [ [ 'name' => 'pdf', 'filename' => '', 'contents' => null ], [ 'name' => 'invoice', 'contents' => 'string' ] ] 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"pdf\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"invoice\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"validate\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enforcePending\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"formatOptions\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let parameters = [ [ "name": "pdf", "fileName": "" ], [ "name": "invoice", "value": "string" ], [ "name": "validate", "value": ], [ "name": "enforcePending", "value": ], [ "name": "formatOptions", "value": ] ] 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://service.invoice-api.xhub.io/api/v1/invoice/DE/facturx/embed/upload")! 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() ```