# Account details Source: https://docs.pdfshift.io/api-reference/account/account-details https://api.pdfshift.io/openapi.json get /account Returns the account details for the connected API Key # Create API key Source: https://docs.pdfshift.io/api-reference/api-keys/create-api-key https://api.pdfshift.io/openapi.json post /account/api Creates a new API key for the connected account with basic level (not master). This endpoint requires an API key with the `master` privilege (or a Bearer token from the Dashboard). If the account has reached the maximum number of allowed active API keys, the request will be refused. If you want to create an API key with master access, you need to create it via the Dashboard. # Disable API key Source: https://docs.pdfshift.io/api-reference/api-keys/disable-api-key https://api.pdfshift.io/openapi.json post /account/api/{key}/disable Disables an API key. The `{key}` path parameter is the secret key (`token`) of the API key to disable. You cannot disable your last remaining active key, as one must always be kept active. A `master` key can only be disabled from the Dashboard. # Enable API key Source: https://docs.pdfshift.io/api-reference/api-keys/enable-api-key https://api.pdfshift.io/openapi.json post /account/api/{key}/enable Enables (un-disables) an API key. The `{key}` path parameter is the secret key (`token`) of the API key to enable. Enabling a key is refused when it would exceed the maximum number of allowed active keys. A `master` key can only be managed from the Dashboard. # Update API key Source: https://docs.pdfshift.io/api-reference/api-keys/update-api-key https://api.pdfshift.io/openapi.json put /account/api/{key} Updates the `name` of an existing API key. The `{key}` path parameter is the secret key (`token`) of the API key to update. This endpoint only works with an API key with the `master` privilege. # Convert to JPEG Source: https://docs.pdfshift.io/api-reference/convert-to-jpeg https://api.pdfshift.io/openapi.json post /convert/jpeg This endpoint will convert an HTML document to a JPEG image. You can specify additional options to customize the output image, such as capturing the full page, selecting specific elements using CSS selectors, or defining a clip region. Only one of `fullpage`, `css_selector`, or `clip` can be set at a time. Please note that the response from this endpoint will vary depending on some parameters. You can read more at [Varying responses](/docs/varying-responses). # Convert to PDF Source: https://docs.pdfshift.io/api-reference/convert-to-pdf https://api.pdfshift.io/openapi.json post /convert/pdf Convert a given HTML document to a PDF file. You can provide the HTML source directly, or a URL to fetch it from. Numerous options are available to customize the generated PDF document. Please note that the response from this endpoint will vary depending on some parameters. You can read more at [Varying responses](/docs/varying-responses). # Convert to PNG Source: https://docs.pdfshift.io/api-reference/convert-to-png https://api.pdfshift.io/openapi.json post /convert/png This endpoint will convert an HTML document to a PNG image. You can specify additional options to customize the output image, such as capturing the full page, selecting specific elements using CSS selectors, or defining a clip region. Only one of `fullpage`, `css_selector`, or `clip` can be set at a time. Please note that the response from this endpoint will vary depending on some parameters. You can read more at [Varying responses](/docs/varying-responses). # Convert to WEBP Source: https://docs.pdfshift.io/api-reference/convert-to-webp https://api.pdfshift.io/openapi.json post /convert/webp This endpoint will convert an HTML document to a WEBP image. You can specify additional options to customize the output image, such as capturing the full page, selecting specific elements using CSS selectors, or defining a clip region. Only one of `fullpage`, `css_selector`, or `clip` can be set at a time. Please note that the response from this endpoint will vary depending on some parameters. You can read more at [Varying responses](/docs/varying-responses). # Credits usage Source: https://docs.pdfshift.io/api-reference/credits/credits-usage https://api.pdfshift.io/openapi.json get /credits/usage Returns the current credits usage with some details to help you know where your usage is at. It contains the `total` credits, the `remaining` credits you can use for your period and the `used` number of credits. The `base` value might differ from the `total` if you have enabled overage. In this case, `base` represent the default limit from your current plan, whereas `total` is the limit set in your overage. Once your credit usage reaches the `total`, the conversions will be refused. # Pricing list Source: https://docs.pdfshift.io/api-reference/credits/pricing-list https://api.pdfshift.io/openapi.json get /credits/pricing Returns the list of available plans and their pricing. This endpoint is public and can be reached without authentication. However, if you provide your API key through the `X-API-Key` header, the response may also include custom plans specific for your account, in addition to the standard public plans. # Get log by request ID Source: https://docs.pdfshift.io/api-reference/get-log-by-request-id https://api.pdfshift.io/openapi.json get /logs/{request_id} # Invoices list Source: https://docs.pdfshift.io/api-reference/invoices-list https://api.pdfshift.io/openapi.json get /invoices # List recent logs Source: https://docs.pdfshift.io/api-reference/logs/list-recent-logs https://api.pdfshift.io/openapi.json get /logs # Create template Source: https://docs.pdfshift.io/api-reference/templates/create-template https://api.pdfshift.io/openapi.json post /templates Creates a new template stored at PDFShift. # Delete template Source: https://docs.pdfshift.io/api-reference/templates/delete-template https://api.pdfshift.io/openapi.json delete /templates/{slug} Deletes a template by slug. # Generate document from template Source: https://docs.pdfshift.io/api-reference/templates/generate-document-from-template https://api.pdfshift.io/openapi.json post /templates/{slug}.{ext} Generates a document from a template using provided data. Supported extensions: html, pdf, jpeg, png, webp. # Get template HTML Source: https://docs.pdfshift.io/api-reference/templates/get-template-html https://api.pdfshift.io/openapi.json get /templates/{slug}.html Returns the raw HTML content of the template. # List templates Source: https://docs.pdfshift.io/api-reference/templates/list-templates https://api.pdfshift.io/openapi.json get /templates Returns a list of templates registered to your account. # Update template Source: https://docs.pdfshift.io/api-reference/templates/update-template https://api.pdfshift.io/openapi.json put /templates/{slug} Update the name or content of a template. Slug cannot be changed. # Authentication Source: https://docs.pdfshift.io/docs/authentication Authenticate your account by including your **secret API key** in every request.\ You can create and manage API keys from the Dashboard. Send your key using the following HTTP header: `X-API-Key: sk_xxxxxx.....` If the `X-API-Key` header is **absent**, **empty**, or **malformed**, the API will treat the request as coming from a **free account**. Free accounts are subject to **more restricted limits and capabilities** than authenticated requests. ## Free or unauthenticated account limits Free (or unauthenticated) accounts can access the same PDFShift endpoint to convert a document, but with very restricted usage. Specifically: 1. Generated documents include a watermark, even if `sandbox` is set to `false`. 2. Documents larger than **2 MB** cannot be converted. 3. Requests have a shorter timeout of **30 seconds**. 4. You can only do **up to 10 conversions per day**. 5. Parallel requests are not allowed. If you believe you are sending your API key using the `X-API-Key` header but are still seeing these restrictions, it likely means the request is malformed (for example, the header name is incorrect or the key is not properly formatted). Don’t hesitate to reach out to us in that case — we’ll help you sort it out. # Error codes Source: https://docs.pdfshift.io/docs/error-codes Most of the errors you will encounter when using our API can be found here. In case something is missing, feel free to let us know. The PDFShift API uses the following error codes: | Error | Status | Meaning | | ----- | ---------------------------------------------------------- | --------------------------------------------------------------------------------- | | 400 | Bad Request | Your request is invalid. Often, it means a parameter was wrongly set. | | 401 | Unauthorized | No API key were found. | | 403 | Forbidden | The provided API key is invalid. | | 404 | Not Found | The page you tried to reach was not found. | | 405 | Method Not Allowed | The endpoint you tried to reach is not available with this HTTP method. | | 408 | A timeout error occured when trying to convert a document. | | | 429 | Too Many Requests | You sent too many request. Please see the Rate limiting section for more details. | | 500 | Internal Server Error | We had a problem with our server. | # Getting an API Key Source: https://docs.pdfshift.io/docs/getting-an-api-key In order to generate PDF without the PDFShift's watermark, you will need an API Key. You can request one by creating an account on PDFShift's website. Once you have submitted the form, we will send you an email containing your API Key. You can also create other API Key if you want, to split your keys accross your project. This can be done via your Dashboard. You can test and play with our API without an API Key. Simply don't provide the `X-API-Key` header and the request will be done, with the difference that a watermark will be applied to the document. Applying a watermark makes the generation slower, so you will have better result when using your API Key # Rendering header and footer Source: https://docs.pdfshift.io/docs/header-footer You can configure the aspect of your header and footer document using the following values. The footer and header are Independent from the rest of the document. As such, the CSS style defined in your body won't apply on your header/footer. To style your header/footer, you need to set a specific style either using `