Storing generated documents in your own system and displaying them

While we recommend that you keep you generated documents in Inkit's secure storage and retrieve them through document IDs in your application when you want to display them, you can also download them into your own datastore and then retrieve and display them in your application.

To do this, make the following API call:

# Import the Inkit Python package
import inkit
from inkit.exceptions import InkitResponseException

# Replace the string below with your API key
inkit.api_token = "ENTER YOUR API KEY"

try:
   # Specify the ID of the document
   doc_id = "ENTER YOUR DOCUMENT ID",
   # Get a generated PDF document
   resp = inkit.Document.download(doc_id)
except InkitResponseException as err:
   # Print any error
   print(err.response.data)
// Import the Inkit Node.js package
const Inkit = require("inkit");

// Replace the string below with your API key
Inkit.apiToken = "ENTER YOUR API KEY";

// Call PDF download
downloadDocument();

// Download a PDF document
async function downloadDocument() {
    try {
        const result = await Inkit.Document.download('ENTER YOUR DOCUMENT ID');
        // Print the JSON response of the API call
        console.log(JSON.stringify(result.data, null, 3));
    } catch (error) {
        // Print any error
        console.error(error.response.status, error.response.statusText);
    }
}
curl --request GET \
     --url https://api.inkit.com/v1/download/ENTER_YOUR_DOCUMENT_ID \
     --header 'X-Inkit-API-Token: ENTER YOUR API KEY' \
     --header 'accept: application/pdf'

After executing the above call, you will have the raw contents of the generated document, which you can write to your datastore. Afterward, you can display the document in your application using a PDF viewer of your choice.