Stream a Document

Retrieve documents page by page on demand with document streaming

Read this documentation topic, and you'll pull documents using document streaming. The process is similar to pulling renders from the API like normally.

However, when you stream the document, your end user can't download it on their device. It is a handy security feature that benefits those who do not want any data to float out of their organization.

Prerequisites:

  • You have generated a PDF document
  • You have the ID of this generated document
  • You have a mock request tool like Postman or Insomnia available (or have your development environment set up to send requests)
  • Your API key has the appropriate permissions (Renders.retrieve)
  • Your API key has access to your folder if it is a private folder

Read more about:

Before we start

Have the ID of the render you want to generate at hand. Also, have your API request tool open. For this tutorial, we are using Insomnia. But you can use any other request tool you like.

Your document ID will have the format of: "rend_" plus 22 non-spaced alphanumeric characters. So, for example, it may look like this:

rend_1a2b3h45j6k7h4kSfeAoe4

Also, ensure that you have an API key with the appropriate permissions. If you do not, you will not be authorized to make the request.

Refer to the links under the prerequisites if you need a refresher.

Stream the document

  1. Open your mock request tool and make a new GET request.
  1. Input the correct endpoint and specify the Render you want to stream and what page number you want to be streamed. You can build the URL to input like the following:
https://api.inkit.com/v1/render/ + [yourRenderID] + /pdf?page= + [ThePageYouWantStreamed]

Here's an example:

https://api.inkit.com/v1/render/rend_1a2b3h45j6k7h4kSfeAoe4/pdf?page=1

  1. In the JSON headers of the request, you must include the API key. You can create a header parameter called X-Inkit-API-Token and fill in your API Key.
  1. Send your request.

Congrats! You successfully streamed a document. If you have a multi-page document, try inputting different page numbers in the request endpoint.

While this may seem very similar to pulling renders, the critical difference is that the render is transferred by streaming.


Did this page help you?