NAV
shell

SlidePack API Docs

Welcome to SlidePack API! SlidePack can generate PowerPoint files from pptx templates and JSON data.

Learn more about SlidePack here

Getting Started

SlidePack is an API service, but you can give it a spin from the Web Console.

For API use, please see reference below.

API Reference

Authentication

Example:

curl "https://slidepack.io/sessions" \
  -H "Authorization: Bearer {api_token}"

All endpoints require authentication. Include your API token in the request header to authenticate. You can create your API token on the Web Console.

Authorization: Bearer {api_token}

Create a Session

curl -X "POST" "https://slidepack.io/sessions" \
     -H 'Authorization: Bearer {api_token}'

Returns JSON that looks like:

{
  "session": {
    "uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
    "is_rendered": null,
    "message": null,
    "created_at": "2020-08-13T13:14:32.000000Z",
    "updated_at": "2020-08-13T13:14:32.000000Z"
  },
  "upload": {
    "action": "https://slidepack-api.s3.ap-northeast-1.amazonaws.com",
    "method": "POST",
    "enctype": "multipart/form-data",
    "params": {
      "acl": "private",
      "key": "sessions/zip/f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36.zip",
      "Content-Type": "application/zip",
      "X-Amz-Security-Token": "***",
      "X-Amz-Credential": "***",
      "X-Amz-Algorithm": "AWS4-HMAC-SHA256",
      "X-Amz-Date": "20200813T131432Z",
      "Policy": "***",
      "X-Amz-Signature": "***"
    }
  }
}

Use this endpoint to create a Session and receive AWS S3 Pre-Signed POST parameters that you will need later to upload your zip file.

HTTP Request

POST https://slidepack.io/sessions

Query Parameters

None

Response

201 Created

Key Description
session Session information. Identical to what is returned from GET /sessions/{uuid}.
upload Parameters to be used later to upload the input zip file directly to S3.

Upload zip file

curl -X "POST" "https://slidepack-api.s3.ap-northeast-1.amazonaws.com/" \
     -F "acl=private" \
     -F "key=sessions/zip/{uuid}.zip" \
     -F "Content-Type=application/zip" \
     -F "X-Amz-Security-Token=***" \
     -F "X-Amz-Credential=***" \
     -F "X-Amz-Algorithm=AWS4-HMAC-SHA256" \
     -F "X-Amz-Date=***" \
     -F "Policy=***" \
     -F "X-Amz-Signature=***" \
     -F "file=@/path/to/your/data.zip"

Issue this request to upload a zip file directly to Amazon S3 to be used for rendering.

HTTP Request

POST {endpoint}

Replace {endpoint} with the upload.action value from POST /sessions or GET /sessions/{uuid}.

Form-Data Parameters

Key Required Notes
acl yes Use value from POST /sessions or GET /sessions/{uuid}.
key yes Same as above
Content-Type yes Same as above
X-Amz-Security-Token yes Same as above
X-Amz-Credential yes Same as above
X-Amz-Algorithm yes Same as above
X-Amz-Date yes Same as above
Policy yes Same as above
X-Amz-Signature yes Same as above
file yes Append your zip file to the end of these parameters.

Response

204 No Content

Render

Use this endpoint to render your uploaded zip file into pptx and get the download URL.

curl -X "POST" "https://slidepack.io/sessions/{uuid}/render" \
     -H 'Authorization: Bearer {api_token}'

Returns JSON that looks like:

{
  "session": {
    "uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
    "is_rendered": true,
    "message": "Render succeeded.",
    "created_at": "2020-08-13T13:14:32.000000Z",
    "updated_at": "2020-08-13T13:17:43.000000Z"
  },
  "download_url": "https://slidepack-api.s3.ap-northeast-1.amazonaws.com/..."
}

HTTP Request

POST https://slidepack.io/sessions/{uuid}/render

Query Parameters

None

Response

200 OK

Key Description
session Session information. Identical to what is returned from GET /sessions/{uuid}.
download_url Download URL for your rendered pptx file.

List Sessions

curl "https://slidepack.io/sessions" \
     -H 'Authorization: Bearer {api_token}'

Returns JSON that looks like:

{
  "sessions": [
    {
      "uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
      "created_at": "2020-08-13T13:14:32.000000Z",
      "is_rendered": true
    }
  ]
}

Use this endpoint to retrieve a list of Sessions created within 24 hours.

HTTP Request

GET https://slidepack.io/sessions

Query Parameters

None

Response

200 OK

Get Session details

curl "https://slidepack.io/sessions/{uuid}" \
     -H 'Authorization: Bearer {api_token}'

Returns JSON that looks like:

{
  "session": {
    "uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
    "is_rendered": null,
    "message": null,
    "created_at": "2020-08-13T13:14:32.000000Z",
    "updated_at": "2020-08-13T13:17:43.000000Z"
  }
}

Get detailed information about a Session.

HTTP Request

GET https://slidepack.io/sessions/{uuid}

Query Parameters

None

Response

200 OK

JSON / Template Syntax

data.json

[
  {
    "template": 1,
    "some_text": "text to replace"
  },
  {
    "template": 2,
    "some_table": {
      "type": "table",
      "rows": [
        ["this", "is", "header"],
        ["this", "is", "first row"]
      ]
    }
  }
]

Input to SlidePack consists of JSON data and a pptx template.

JSON data is used to populate the template, and should be shaped as shown on the right. The file must be named data.json.

The template is much like a Pug, ERB or Blade template, except in pptx format. Its slides can contain placeholders for variables to be populated with values from JSON data. This file must be named template.pptx.

template

Combine these two files into a zip file. Now it's ready to be uploaded to SlidePack API.

Populating text

Replace placeholders in text boxes or table cells.

Simple

Replace placeholders with string values.

data.json

[
  {
    "template": 1,
    "text1": "Text boxes can be placed anywhere in a slide.",
    "text2": "Fonts and styles from the template are preserved.",
    "text3": "Text box properties like auto-sizing are also preserved.",
    "text4": "You can",
    "text5": "replace",
    "text6": "text in",
    "text7": "tables."
  }
]

template.pptx

text.simple.template

This input renders into:

text.simple.output

With options

Use an object instead of a string to specify options.

data.json


{
  "template": 1,
  "text1": {
    "type": "text",
    "value": "Override styles by providing options.",
    "styles": {
      "font": {
        "size": 28,
        "color": "#000000",
        "underline": true,
        "italic": true
      },
    }
  }
}

template.pptx

text.options.template

This input renders into:

text.options.output

Text object parameters

Key Required Value
type yes "text"
value yes String
styles.font.typeface String
styles.font.size Number
styles.font.color Hex
styles.font.underline Boolean
styles.font.italic Boolean
styles.font.bold Boolean
styles.font.strike Boolean
styles.shape.fill Hex
styles.shape.outline Hex

Populating tables

Populate tables with arrays of data.

Use tables' alt text to identify tables.

Simple

Populate a table with an array of strings.

data.json

{
  "template": 1,
  "table1": {
    "type": "table",
    "rows": [
      ["Fill", "a table", "with data", "from", "an array."],
      ["a", "b", "c", "d", "e"],
      ["f", "g", "h", "i", "j"],
      ["k", "l", "m", "n", "o"],
      ["p", "q", "r", "s", "t"],
      ["u", "v", "w", "x", "y"]
    ]
  },
  "table2": {
    "type": "table",
    "rows": [
      ["If you have joined cells", "", "", "", ""],
      ["join state is", "", "preserved", "", ""],
      ["", "", "", "", ""],
      ["", "", "", "", ""],
      ["", "", "", "", ""],
      ["p", "q", "r", "s", "t"],
      ["u", "v", "w", "x", "y"]
    ]
  }
}

template.pptx

table.simple.template

This input renders into:

table.simple.output

With options

Provide objects instead of strings to specify options per cell.

data.json

{
  "template": 1,
  "table1": {
    "type": "table",
    "rows": [
      [
        {
          "value": "You can",
          "styles": {
            "font": { "color": "#ffffff" },
            "shape": { "fill": "..." }
          }
        },
        {
          "value": "specify",
          "styles": {
            "font": { "color": "#ffffff" },
            "shape": { "fill": "..." }
          }
        },
        ...
      ]
    ]
  }
}

template.pptx

table.options.template

This input renders into:

table.options.output

Table object parameters

Key Required
type yes table
rows.[].value yes String
rows.[].styles.* Same as for text

Populating charts

Populate charts with objects containing data.

data.json

{
  "template": 1,
  "chart1": {
    "type": "chart",
    "labels": ["Q1", "Q2", "Q3", "Q4"],
    "axis1": {
      "bounds": {
        "minimum": 50,
        "maximum": 150
      },
      "series": {
        "ser1": {
          "name": "Revenue",
          "values": [100, 110, 120, 130]
        },
        "ser2": {
          "name": "Expenses",
          "values": [50, 55, 60, 65]
        }
      }
    },
    "axis2": {
      "series": {
        "ser3": {
          "name": "Gross profit margin",
          "values": [0.5, 0.6, 0.7, 0.8]
        }
      }
    }
  }
}

template.pptx

chart.options.template

This input renders into:

chart.options.output

Chart object parameters

Key Required Value
type yes chart
labels yes [String]
axis1.series yes [Object]
axis1.series.[var].name yes String
axis1.series.[var].values yes [Number]
axis1.bounds.minimum Number
axis1.bounds.maximum Number
axis2.series
axis2.series.[var].name
axis2.series.[var].values
axis2.bounds.minimum Number
axis2.bounds.maximum Number

API Limits

Title Limit Notes
Rate limit 600 requests/minute
Session expires in 24 hours Only one unrendered session is kept at a time regardless of this expiry.
Zip upload max size 50MB
Upload URL expires in 60 minutes Can be reissued as many times as needed as long as the session hasn't expired.
Download URL expires in 5 minutes Same as above