API Documentation

Create Order API

The Create Order API allows you to programmatically create print orders through our service. This is particularly useful for businesses that want to integrate printing services directly into their applications.

Endpoints

The API is versioned to ensure backward compatibility. We recommend using the latest version.

Endpoint (v1)

POST https://skrivutonline.se/api/v1/create-order

Authentication

Currently, the API uses partner-based authentication. You need to include a valid partner ID in your request. Contact us to get a partner ID for your integration.

Request Format

The API accepts JSON payloads with the following structure:

{
  "files": [
    {
      "url": "https://example.com/document.pdf",
      "filename": "document.pdf",
      "copies": 1
    }
  ],
  "email": "[email protected]",
  "name": "Customer Name",
  "address": "Customer Address",
  "addressLine2": "Apartment 4",
  "postalCode": "12345",
  "city": "City Name",
  "countryCode": "SE",
  "state": "",
  "paperSize": "A4",
  "media": "standard",
  "afterTreatment": "none",
  "duplex": "no",
  "scaling": "auto",
  "deliveryMethod": "postnord",
  "partner": "<your partner id>",
  "discreetPackaging": false,
  "test": false
}

Field Descriptions

FieldTypeRequiredDescription
filesArrayYesArray of file objects to print
files[].urlStringYesPublicly accessible URL to download the PDF file
files[].filenameStringYesName of the file
files[].copiesNumberNoNumber of copies to print (default: 1)
emailStringYesCustomer email address
nameStringYesCustomer name
addressStringYes*Delivery address (*not required if deliveryMethod is "pickup")
apartmentNrStringNoApartment number or additional address information
addressLine2StringNoOptional second address line, stored separately from address and apartmentNr
countryCodeStringNoTwo-letter EU country code, for example SE, FI or DE. Defaults to SE when omitted, null or empty. Surrounding whitespace is removed and lowercase codes are accepted.
stateStringNoOptional region, county or state, for example an Irish county
postalCodeStringYes*Postal code (*not required if deliveryMethod is "pickup")
cityStringYes*City (*not required if deliveryMethod is "pickup")
paperSizeStringNoPaper size (default: "A4")
mediaStringNoPaper type (default: "standard")
afterTreatmentStringNoAfter-treatment option (default: "none")
duplexStringNoDuplex printing option (default: "no")
scalingStringNoScaling option (default: "auto")
deliveryMethodStringNoDelivery method (default: "postnord")
partnerStringYesPartner ID (contact us to get your partner ID)
notificationPhoneStringNoPhone number for delivery notifications
langStringNoLanguage code (default: "sv")
discreetPackagingBooleanNoWhether to use discreet packaging (default: false)
testBooleanNoValidates and prices the request without creating an order (default: false)

International Delivery

Delivery is available to these EU country codes: AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE. Other country codes return HTTP 400. The countryCode, addressLine2 and state fields are optional; requests without a country code continue to use Sweden.

Delivery outside Sweden adds 30 SEK per order, regardless of the number of files or copies. Priority delivery adds its usual 39 SEK as well. Test mode returns the same calculated price as a real order.

International orders require name, email, address, postalCode and city. Postal codes are strings and may contain letters or spaces. Pickup is available only with countryCode SE.

Use the same deliveryMethod values as for Swedish orders. For postnord, the service selects postnordUntrackable when the total package weight exceeds 150 grams. Tracking and priority selections use international tracked delivery. International orders are handled manually before shipping.

International Order Example

{
  "files": [{
    "url": "https://example.com/document.pdf",
    "filename": "document.pdf",
    "copies": 1
  }],
  "email": "[email protected]",
  "name": "Customer Name",
  "address": "12 Example Street",
  "addressLine2": "Apartment 4",
  "postalCode": "D02 XY12",
  "city": "Dublin",
  "countryCode": "IE",
  "state": "County Dublin",
  "deliveryMethod": "postnord",
  "partner": "<your partner id>",
  "test": true
}

Available Options

Paper Size Options

  • A3 - A3 paper (297×420 mm)
  • A4 - A4 paper (210×297 mm)
  • A5 - A5 paper (148×210 mm)

Media Options

  • standard - Standard 80g paper
  • 100g - 100g paper
  • 160g - 160g paper
  • 300g - 300g paper
  • holes - Paper with holes
  • sticker - Sticker paper

After Treatment Options

  • none - No special treatment
  • spiralBinding - Spiral binding
  • laminated - Lamination
  • stapling - Stapling
  • framing - Framing
  • vfolding - V-folding

Duplex Options

  • no - Single-sided printing
  • longEdge - Double-sided printing, flip on long edge
  • shortEdge - Double-sided printing, flip on short edge

Scaling Options

  • auto - Automatically fit to page
  • actual - Print at actual size

Delivery Method Options

  • postnord - Standard PostNord delivery
  • postnordTrackable - PostNord with tracking
  • postnordTrackablePriority - PostNord with tracking and priority
  • pickup - Pickup at our location

Valid Combinations

Not all combinations of paper size, media, and after-treatment are valid. The API will return an error if an invalid combination is provided. Here are some examples of valid combinations:

Paper SizeAfter TreatmentMedia
A3none160g
A3laminated160g
A4nonestandard
A4spiralBinding100g
A5nonestandard
A5laminatedstandard

Response Format

The API returns JSON responses with the following structure:

Success Response

{
  "success": true,
  "id": "b2822f925091433aab431e7fae0fadb5",
  "price": 123.45,
  "test": false
}

The price is returned in SEK.

Test Mode

Set test to true to validate the request, process the PDF files, and calculate the price without creating or confirming an order. The returned ID is temporary and does not refer to a created order.

{
  "success": true,
  "id": "b2822f925091433aab431e7fae0fadb5",
  "price": 123.45,
  "test": true
}

Error Response

{
  "success": false,
  "error": "Error message describing what went wrong"
}

Error Codes

The API may return the following HTTP status codes:

  • 200 OK - Request successful
  • 400 Bad Request - Invalid request parameters
  • 405 Method Not Allowed - Only POST method is supported
  • 500 Internal Server Error - Server-side error

Example Usage

Here's an example of how to use the API with cURL:

curl -X POST https://skrivutonline.se/api/v1/create-order \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {
        "url": "https://example.com/document.pdf",
        "filename": "document.pdf",
        "copies": 1
      }
    ],
    "email": "[email protected]",
    "name": "Customer Name",
    "address": "Customer Address",
    "addressLine2": "Apartment 4",
    "postalCode": "12345",
    "city": "City Name",
    "countryCode": "SE",
    "state": "",
    "paperSize": "A4",
    "media": "standard",
    "afterTreatment": "none",
    "duplex": "no",
    "scaling": "auto",
    "deliveryMethod": "postnord",
    "partner": "skrivutonline",
    "discreetPackaging": false,
    "test": false
  }'

JavaScript Example

Here's an example of how to use the API with JavaScript:

async function createOrder() {
  const orderData = {
    files: [
      {
        url: "https://example.com/document.pdf",
        filename: "document.pdf",
        copies: 1
      }
    ],
    email: "[email protected]",
    name: "Customer Name",
    address: "Customer Address",
    addressLine2: "Apartment 4",
    postalCode: "12345",
    city: "City Name",
    countryCode: "SE",
    state: "",
    paperSize: "A4",
    media: "standard",
    afterTreatment: "none",
    duplex: "no",
    scaling: "auto",
    deliveryMethod: "postnord",
    partner: "<your partner id>",
    discreetPackaging: false,
    test: false
  };

  try {
    const response = await fetch("https://skrivutonline.se/api/v1/create-order", {
      method: "POST",
      headers: {
        "Content-Type": "application/json"
      },
      body: JSON.stringify(orderData)
    });

    const result = await response.json();
    
    if (result.success) {
      console.log("Order created successfully with ID:", result.id);
      console.log("Order price (SEK):", result.price);
    } else {
      console.error("Failed to create order:", result.error);
    }
  } catch (error) {
    console.error("Error creating order:", error);
  }
}

Contact

If you need assistance with the API or want to become a partner, please contact us at [email protected].

Till toppen
Skriv Ut Sverige AB
Org nr: 559321-4199
Havregatan 13
118 59 Stockholm

08 - 414 006 73

[email protected]