Link

Send B2C invoices

IMPORTANT
Before using B2C you have to activate B2C delivery methods, currently it’s possible to send B2C invoices using multiple providers:

  • Kivra - activated via API, more info can be found here
  • 21Grams - manually activated by contacting InExchange support

Step 1: Request a token

To send an invoice a token is needed. You create tokens with the Create Token call. Tokens can be set to be valid for a period of time or set to never expire. You need to decide if you want to store the token of each company in your system, or request a new one for each communication session. We recommend that tokens are created with a short TTL of 10 minutes.

Request Example

POST /v1/api/clientTokens/create HTTP/1.1
APIKey: --YOUR API KEY HERE--
Content-Type: application/json; charset=utf-8
Host: testapi.inexchange.se
Content-Length: 183
Expect: 100-continue

{
  "erpId": "635604692357550266",
  "validTo": "2026-05-26T12:54:10"
}

Response Example

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 63
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
Date: Tue, 26 May 2026 12:54:10 GMT

{
  "token": "--CLIENT TOKEN HERE--"
}

Step 2: Upload documents

There are two ways documents can be uploaded. This page will highlight the more common and recommended approach which involves two stages where one first upload documents and then issue a send request for those documents.

This means that both the actual invoice and the associated attachments will need to be uploaded using this method first. Each upload will then return a Location header if the upload was successful which is the reference for this document which should be stored and to be used in the next step.

Request Example

POST /v1/api/documents HTTP/1.1
Host: testapi.inexchange.se
ClientToken: --CLIENT TOKEN HERE--
Content-Type: multipart/form-data; boundary=X-TEST-BOUNDARY
Accept: */*
Content-Length: 153

--X-TEST-BOUNDARY
Content-Disposition: form-data; name="File"; filename="testfile.xml"
Content-Type: application/xml
--X-TEST-BOUNDARY--

Response Example

HTTP/1.1 202 Accepted
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Location: urn:inexchangedocument:4a149d3d-da2d-4d77-9046-694e4ef7b111
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 26 May 2026 12:54:10 GMT
Content-Length: 0

Step 3: Send uploaded documents

In order to send the previously uploaded documents in step 2, a request to Send documents. In this call all document references will be supplied in order to specify which of the documents is the main one and which are attachments. It’s also used to specify the documentformat of the uploaded main document in addition to metadata for each delivery method.

There is also an option for the integrator to associate a document with an id owned by the integrator. It’s possible to supply the id in the field ErpDocumentId which can later be used to fetch the document info in for example get invoice status and get order status

A successful call to Send documents will return a Location header with a link to the document. The last path parameter in this link will be the DocumentId, this can be seen as equivilent to the ErpDocumentId above with the difference that it’s the document id owned by InExchange, which will be the main id used to identify the document henceforth.

  • BusinessToConsumer.Provider is required only if you have more then one B2C provider.
  • SSN is used only with Kivra
  • FMI is used with 21Grams

Request Example

POST /v1/api/documents/outbound HTTP/1.1
Host: testapi.inexchange.se
ClientToken: --CLIENT TOKEN HERE--
Content-Type: application/json
Accept: */*
Content-Length: 1387

{
  "sendDocumentAs": {
    "type": "BusinessToConsumer",
    "BusinessToConsumer": {
      "ssn": "198500000000",      
      "provider": "Kivra"
    }
  },  
  "document": {
    "documentFormat": "svefaktura",
    "documentUri": "urn:inexchangedocument:4a149d3d-da2d-4d77-9046-694e4ef7b111",
    "renderedDocumentFormat": "application/pdf",
    "renderedDocumentUri": "urn:inexchangedocument:4a149d3d-da2d-4d77-9046-694e4ef7b111",
    "attachments": [
      "urn:inexchangedocument:4a149d3d-da2d-4d77-9046-694e4ef7b111"
    ],
    "language": "sv-SE",
    "culture": "sv-SE"
  }
}

Response Example

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Location: http://testapi.inexchange.se/v1/api/documents/outbound/1c4121fb-f850-41c7-ab7b-815d197dc11b
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 26 May 2026 12:54:10 GMT
Content-Length: 0

Step 4: Document status

After having sent the documents they start passing through different stages before actually sending the documents. These stages are described by different document statuses which can be followed up by issuing a call to Document status.

This will return the current status and historical status changes of the document as well as specify the document type. The document type is not set to the actual document until it passed all checks in the API before being pushed into InExchange Platform. Until then the document type will classified as Document.

Request Example

GET /v1/api/documents/outbound/1c4121fb-f850-41c7-ab7b-815d197dc11b HTTP/1.1
Host: testapi.inexchange.se
ClientToken: --CLIENT TOKEN HERE--
Accept: */*

Response Example

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 302
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 26 May 2026 12:54:10 GMT

{
  "statusHistory": [
    {
      "status": "Pending",
      "time": "2026-05-26T12:54:10+0000"
    }
  ],
  "id": "1c4121fb-f850-41c7-ab7b-815d197dc11b",
  "documentType": "Document",
  "currentStatus": {
    "status": "Pending",
    "time": "2026-05-26T12:54:10+0000"
  }
}