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",
  "postalCode": "12345",
  "city": "City Name",
  "paperSize": "A4",
  "media": "standard",
  "afterTreatment": "none",
  "duplex": "no",
  "scaling": "auto",
  "deliveryMethod": "postnord",
  "partner": "<your partner id>",
  "discreetPackaging": 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
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)

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"
}

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",
    "postalCode": "12345",
    "city": "City Name",
    "paperSize": "A4",
    "media": "standard",
    "afterTreatment": "none",
    "duplex": "no",
    "scaling": "auto",
    "deliveryMethod": "postnord",
    "partner": "skrivutonline",
    "discreetPackaging": 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",
    postalCode: "12345",
    city: "City Name",
    paperSize: "A4",
    media: "standard",
    afterTreatment: "none",
    duplex: "no",
    scaling: "auto",
    deliveryMethod: "postnord",
    partner: "<your partner id>",
    discreetPackaging: 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);
    } 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]