API Tokens
API tokens let you access Papermerge functionality programmatically — through scripts, tools, or other applications. To give an external application access to Papermerge, you first need to provide it with an API token issued by Papermerge.
Create an API Token
Section titled “Create an API Token”To create an API token:
- Click the user icon in the upper-right corner of the web interface.
- Select API Tokens, then click Create Token.
- Give the token a name (e.g. “Used by my script”) and choose how many days it should remain valid.
Once created, a Token Created dialog shows the token in clear text. Copy the token and store it somewhere secure.
Use an API Token
Section titled “Use an API Token”To use an API token, add an Authorization header with the value Bearer <your token>. For example:
Authorization: Bearer pm_MAxxThisxxxisxxxxExamplexxxTokenxxxt7IThe REST API documentation is available from the user menu (upper-right corner of the web interface) under REST API.
API Server
Section titled “API Server”- For private accounts, the API server is
https://app.papermerge.com. - For Team accounts, the API server is
https://<tenant-name>-app.papermerge.com.
API Endpoints
Section titled “API Endpoints”All API endpoints include an /api/ prefix between the server host and the rest of the
endpoint, for example:
curl https://app.papermerge.com/api/users/me -H ...
Note that endpoint URLs do not have a trailing /.
Examples with cURL
Section titled “Examples with cURL”Here are a couple of examples of using an API token with the curl client.
Upload a document:
curl https://app.papermerge.com/api/documents/upload \ -H "Authorization: Bearer pm_MAxxThisxxxisxxxxExamplexxxTokenxxxt7I" \ -F "file=@/home/frederik/Documents/utility_01.pdf" \ -F "lang=eng"Get current user details:
curl https://app.papermerge.com/api/users/me \ -H "Authorization: Bearer pm_MAxxThisxxxisxxxxExamplexxxTokenxxxt7I"