Pdf Weaver API How-To

Our API is live at https://api.pdf-weaver.io/api. Your can get the full OpenApi specification at https://api.pdf-weaver.io/swagger/v1/swagger.json and use the interactive Swagger UI at https://api.pdf-weaver.io/swagger/index.html

Step 1: Obtain a token

Before you can interact with the main Pdf Weaver API, you need to obtain an authentication token. To do this, you have two options:

Option 1: Use the API to get the captcha challenge and solve it manually

  1. Make a GET request to the /api/captcha endpoint to get the captcha challenge:
http
GET https://api.pdf-weaver.io/api/captcha
  1. The API will return a base64-encoded image of the captcha challenge. Decode the base64 string to an image using an online tool like base64.guru.

  2. Solve the captcha challenge manually and note down the solution and the captcha secret.

  3. Call the /api/token endpoint with the required parameters:

  • userId: Your email address, which will serve as your user ID.
  • captchaSolution: The solution to the captcha challenge.
  • captchaSecret: The captcha secret associated with the captcha challenge.
http
GET https://api.pdf-weaver.io/api/token?userId=YOUR_EMAIL_ADDRESS&captchaSolution=CAPTCHA_SOLUTION&captchaSecret=CAPTCHA_SECRET

Upon successful authentication, the API will return a token that you will use in subsequent requests. Additionally, you will receive a confirmation email containing the token.

Option 2: Use the token generation feature on the Pdf Weaver website

  1. Visit the Pdf Weaver Live App at https://pdf-weaver.io/app.

  2. Click "Request New Token" on the top to the right.

  3. Enter your email address as your user ID and solve the captcha challenge provided on the page.

  4. Click the "Generate Token" button.

Upon successful authentication, the website will provide a token that you can use in subsequent requests with the Pdf Weaver API. You will also receive a confirmation email containing the token.

Step 2: Generate a PDF

To generate a PDF using the Pdf Weaver API, make a POST request to the /api/service/order endpoint with the required request body:

  • xmlData: The XML data for the document.
  • xslData: The XSL data for the document.
  • tokenId: The token obtained in step 1.
  • userId: Your user ID.
    
http
POST https://api.pdf-weaver.io/api/service/order Content-Type: application/json { "xmlData": "YOUR_XML_DATA", "xslData": "YOUR_XSL_DATA", "tokenId": "YOUR_TOKEN_ID", "userId": "YOUR_USER_ID" }

The API will return a requestId that you will use in the following steps to check the status and retrieve the generated PDF.

Step 3: Check the status of the PDF generation

To check the status of your PDF generation request, make a GET request to the /api/service/order/state endpoint with the requestId obtained in step 2:

http
GET https://api.pdf-weaver.io/api/service/order/state?requestId=YOUR_REQUEST_ID

The API will return the current status of the PDF generation process. Keep polling this endpoint until the status indicates that the process is complete.

Step 4: Retrieve the generated PDF

Once the PDF generation process is complete, make a GET request to the /api/service/order/result endpoint with the requestId obtained in step 2:

http
GET https://api.pdf-weaver.io/api/service/order/result?requestId=YOUR_REQUEST_ID

The API will return the generated PDF as a binary file, which you can save and use as needed.

Optional: Get captcha challenge (if required)

If the API requires captcha verification, you can get the captcha challenge by making a GET request to the /api/captcha endpoint:

http
GET https://api.pdf-weaver.io/api/captcha

Solve the captcha challenge and use the solution and secret in Step 1 to obtain the token.

Optional: Check the API health

To check if the API is up and running, make a GET request to the /api/health endpoint:

http
GET https://api.pdf-weaver.io/api/health

If the API is healthy, the endpoint will return a 200 status code.