Open Reassign Pages

This endpoint allows a document to split, merge, re-arrange multiple page pdfs and create new documents. This functionality is useful for incorrectly split documents which can be split further, merged back together, and re-arranged as required.

POST Parameters

ParameterRequiredValueDescription
api_key{key}An API key that has access to the resource you want to query for.
source_document_id{integer}The source id of document you need to split, merge or re-arrange.
source_pages{string}Page or range of pages in the source document, for example 1 or 1-3.
target_type{string}The options are new or existing. "new" – creates a new document. "existing" – uses an existing target document.
target_document_id{integer}The target id of document if merging or re-arranging.
target_position{integer}The document page number where the source document(s) will be inserted into or merged; For example 4.
Information Circle

Page Operations: Use target_type="new" to create a new document, or target_type="existing" with target_document_id to merge into an existing document.

Code Examples

The cURL, PHP, Python, Node.js, and C# examples call Xtracta from a trusted server. The React example calls an application-defined backend proxy so the API key is never exposed in browser code.

Warning

Store XTRACTA_API_KEY as a server-side environment variable. Never embed it in browser-delivered code.

curl --request POST 'https://api-app.xtracta.com/v1/documents/reassign_pages' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'api_key=<API_KEY>' \
  --data-urlencode 'source_document_id=<SOURCE_DOCUMENT_ID>' \
  --data-urlencode 'source_pages=1-3' \
  --data-urlencode 'target_type=new' \
  --data-urlencode 'target_document_id=<TARGET_DOCUMENT_ID>' \
  --data-urlencode 'target_position=4'

Sample Request

POST https://api-app.xtracta.com/v1/documents/reassign_pages HTTP/1.1
api_key=123&source_document_id=123456&source_pages=1-3&target_type=new&target_document_id=234567&target_position=4

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<documents_response>
    <status>200</status>
    <message>The request has been successfully processed</message>
</documents_response>

Schema Definition

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="ConfidenceType">
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="0"/>
          <xs:maxInclusive value="100"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value=""/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:element name="documents_response">
    <xs:complexType>
      <xs:sequence>
      <xs:element name="status" type="xs:integer" minOccurs="0"/>
      <xs:element name="message" type="xs:string" minOccurs="0"/>
        <xs:element name="error" type="xs:string" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>

Error Responses

For JSON and XML responses generated by this endpoint, the response is wrapped in documents_response and includes the HTTP status code and a message.

StatusMessageDescription
400source_document_id is required / source_document_id must be natural numberSupply the positive integer source document ID.
400source_pages is requiredSupply the source page or pages to move.
400target_type cannot be empty / target_type must be one of the values of [new,existing]Set target_type to new or existing.
400target_document_id is required / target_document_id must be natural numberWhen targeting an existing document, supply its positive integer ID.
400target_position is required / target_position must be natural numberWhen targeting an existing document, supply a valid insertion position.
400Invalid requestThe page reassignment failed. The response error value contains the underlying reason.
500Internal server error occurred. Please try again later or contact support@xtracta.comRetry the request. If it persists, contact support with the source document ID and request timestamp.
Information Circle

Authentication, workflow-permission, IP-access-control, and rate-limit failures can be returned before reassignment runs. Confirm that the API key can access and reassign pages in the source workflow.