Skip to content
English
  • There are no suggestions because the search field is empty.

API documentation - Document

The Document Read API gives authenticated, read-only access to documents in Classic. You can search, filter on metadata, and retrieve full document details, including attachments and PDF versions. This article focuses on how the API works and how to use its requests.

β The Read API for Document is in beta and may contain bugs, limitations, or change before final release!

You can register your interest to join the beta and get early access, test the API in your own environment, and influence how it develops. Participation is free. Pricing for the final version will be communicated closer to general availability.

Learn more here and register your interest here.

💬 This article covers how the API behaves: how requests are structured and what you can do with them. This article does not cover how the feature is enabled in Classic or how the API key is created. You can read more about this in the article: Read-API Document

The Document Read API provides authenticated, read-only access to the documents in Classic. With it you can search for documents, filter on metadata, and retrieve full details for individual documents — including attachments and generated PDF versions.

The API is intended for integrations where you want to surface information from the document module in other systems, reports, or custom applications.

Language and translations

The site’s default language affects some of the names and labels returned through the API. For example, category names for Document are returned based on the default language configured for the site.

This means that if the site’s default language is set to English, the API will return these names and labels in English. If the default language is set to Swedish, the corresponding Swedish names and labels will be returned instead.

This is important to consider when using the API in an external system, report or dashboard.

You can read more about language settings in Classic in the article Manage languages in AM System.


Base URL and requests

https://api.amsystem.com/documents

Every request is authenticated with an API key passed in the Authorization header as a bearer token:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents"

All examples below assume this header is present. Every endpoint is read-only (GET); nothing is created or changed.

Endpoints

Method Path Purpose
GET /documents Search and list documents, with filtering and pagination
GET /documents/{id} Retrieve complete details for a single document
GET /documents/{id}/pdf Generate and download a PDF version of a document
GET

/documents/{id}/attachments/{attachmentId}/download

Download an attachment linked to a document

Search and list documents

GET /documents

Returns a paginated list of documents. Use the query parameters below to search and narrow the results.

Query parameters

Parameter Required Description
q Optional Free-text search across document title and content
page Optional Page number. Default is 1
limit Optional Number of results per page. Default is 20, maximum is 100
onlyincategory Optional Filter by a category ID and all of its child categories
field.operator Optional Filter on a metadata field (see Metadata filtering)
field.subField.operator Optional Filter on a nested metadata field (see Metadata filtering)
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.amsystem.com/documents?q=quality&limit=25"

Metadata filtering

You can filter directly on a document's metadata by combining a field with an operator using the pattern field.operator=value. Nested fields use field.subField.operator=value.

Important:  The operator is always required, including for simple fields. Use edition.eq=5, not edition=5. Unknown or incomplete filter expressions are ignored rather than rejected.  A field written without a valid operator (for example createdBy.id=2) matches no filter rule and is silently ignored — no results are affected and no error is returned. Always verify the resulting query and use a supported operator.

Dates and times: all date-times are in Swedish local time (CET/CEST, UTC+1/UTC+2), formatted YYYY-MM-DDTHH:MM:SS without a timezone suffix. Filters compare against the same clock, so any value you see in a response can be used verbatim as a filter value — approvedTime.gte=2026-05-01 means May 1st in Swedish time.

Filterable fields
Field Description Type
approvedTime When the document was approved Datetime
createdTime When the document was created Datetime
editedTime When the document was last modified Datetime
regNumber Document registration number String
edition Document edition / version number Number
category.id, category.name, category.path Category information Nested
createdBy.id, createdBy.name Creator information Nested
approvedBy.id, approvedBy.name Approver information Nested
Operators
Operator Meaning
eq Equal to
ne Not equal to
gt Greater than
gte Greater than or equal to
lt Less than
lte Less than or equal to
cn Contains. Send plain text; wildcards are added automatically, so name.cn=foo matches any value containing "foo"
like Pattern matching. You supply the wildcards yourself — % (any sequence) and _ (single character). For example name.like=foo% matches values starting with "foo". Note: The % character must be URL-encoded as %25 when used in query parameters. Example: regNumber.like=20%25 matches all registration numbers that starts with "20".
in Matches one of several comma-separated values

Important: When using the like operator with wildcards in a URL query parameter, the % character must be URL-encoded as %25. For example, to search for values containing "foo", use field.like=%25foo%25 instead of field.like=%foo%.

Filtering examples

Find a document by its document number:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?regNumber.eq=232" 

Documents approved on or after a date and created by a specific user:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?approvedTime.gte=2026-01-01&createdBy.id.eq=2&limit=10" 

Documents created before a date, by a named creator:

curl -H "Authorization: Bearer YOUR_API_KEY" \
   "https://api.amsystem.com/documents?createdTime.lt=2024-12-12&createdBy.name.eq=Anders%20Swedin&limit=10" 

Recently approved documents in the category named "Quality":

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?approvedTime.gte=2025-01-01&category.name.eq=Quality" 

Free-text search narrowed to a single category:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?q=onboarding&category.id.eq=5&limit=10" 

Documents edited within a date range:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?editedTime.gte=2025-01-01&editedTime.lte=2025-12-31" 

Documents that have reached at least their second edition, excluding one creator:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?edition.gte=2&createdBy.id.ne=2" 

Other useful filter expressions:

category.name.like=%25Quality%25
category.id.in=5,6,7
regNumber.cn=QMS
regNumber.like=20%25
regNumber.like=%2520%25

# category name contains "Quality" (% encoded as %25)
# category is one of 5, 6, or 7
# registration number contains "QMS" (simpler than like)
# registration number starts with "20"
# registration number contains "20"
Pagination

List responses include a pagination object and, when more pages exist, a links object with ready-to-use navigation URLs.

Field Description
pagination.page Current page number
pagination.pageSize Number of results per page
pagination.totalCount Total number of matching documents
pagination.totalPages Total number of pages
links.next URL for the next page
  links.prev   URL for the previous page
links.first URL for the first page
links.last URL for the last page

To page through a large result set, follow the URL in links.next — it already carries your filters and the next page number:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?page=2&approvedTime.gte=2026-01-24&limit=1" 

Get a single document

GET /documents/{id}

Retrieves complete details for a specific document.

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents/1914"

The response includes the full document content, complete metadata, all attachments with download links, any linked documents, and a URL for PDF generation.

Example response

{
    "id": 1914,
    "name": "Demo document",
    "doctype": "bundle",
    "textContent": "",
    "metaData": {
      "approvedTime": "2026-07-07T10:40:28",
      "createdTime": "2026-07-07T10:29:14",
      "editedTime": "2026-07-07T10:31:34",
        "regNumber": "263",
"regNumberLong": "263:1",
        "edition": 1,
        "category": {
            "id": 18,
            "name": "Huvudprocesser",
          "path": "Demosajt-»Huvudprocesser"
        },
        "createdBy": {
            "id": 2,
            "name": "Anders Swedin"
        },
        "approvedBy": {
            "id": 43,
            "name": "Abigail Svantesson - VD"
        }
    },
    "attachments": [],
    "linkedDocuments": [],
    "bundleDocuments": [
        {
            "id": 1915,
            "name": "Demo textdocument",
            "doctype": "text",
            "textContent": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
            "pdfUrl": "/documents/1915/pdf",
            "attachments": [
                {
                    "id": 156,
                    "name": "​Lorem ipsum dolor sit amet",
                    "filename": "​Lorem ipsum dolor sit amet.jpg",
                    "filesize": "957457",
                    "mime": "image/jpeg",
                    "textContent": null,
                    "downloadUrl": "/documents/1915/attachments/156/download"
                }
            ],
            "linkedDocuments": [
                {
                    "id": 72,
                    "documentUrl": "/documents/664",
                    "name": "1092 Branding"
                }
            ]
        },
        {
            "id": 1916,
          "name": "Demo layoutdocument",
            "doctype": "layout",
            "textContent": "",
            "pdfUrl": "/documents/1916/pdf",
            "attachments": [],
            "linkedDocuments": []
        }
    ],
    "pdfUrl": "/documents/1914/pdf",
  "permaLink": "https://demosajt.amsystem.com/document/263"
}

Note: In list views, textContent is usually truncated.

Generate a document PDF

GET /documents/{id}/pdf 

Generates and returns a PDF version of the document. 

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents/1914/pdf" \
--output document.pdf

Notes on PDF generation

  • Generated PDFs are cached for up to 40 days. Any change that affects the content — a new approved edition, an updated logo, or a change to the site's default language — automatically produces a fresh PDF on the next request, so a cached copy is never out of date.

  • For a bundle document, the endpoint returns a single merged PDF containing all documents in the bundle, combined in order.

Download an attachment

GET /documents/{id}/attachments/{attachmentId}/download 

Downloads a single attachment that is linked to a document. The downloadUrl field on each attachment object already contains the correct relative path.

Query parameters

Parameter Required Description
disposition Optional Controls the Content-Disposition of the delivered file. attachment (default) forces a download; inline lets the browser display the file directly
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents/1914/attachments/156/download" \
  --output Bilaga.zip 

Display an attachment inline instead of forcing a download:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents/1914/attachments/156/download?disposition=inline"

Putting it together

A common end-to-end flow is to search for documents, open one for full details, and then fetch its PDF or an attachment.

1. Search for matching documents

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents?q=quality&category.id.eq=16&limit=10" 

2. Open one document for full details — take an id from the result:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.amsystem.com/documents/1914"

3. Fetch its PDF, or download an attachment — use the pdfUrl and downloadUrl values from the response:

curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.amsystem.com/documents/1914/pdf" --output document.pdf

curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.amsystem.com/documents/1914/attachments/156/download" --output attachment.zip

Object reference

Document object
Field Description
id Unique document ID, which changes with each edition
name Document title
doctype Document type — for example text, layout, or bundle
textContent Document content; usually truncated in list views
metaData Metadata for the document (see below)
attachments List of attachment objects
linkedDocuments List of related documents
bundleDocuments The contained documents when doctype is bundle
pdfUrl Relative URL to generate or download a PDF
permaLink Permanent, user-facing link to the document
MetaData object
Field Description
approvedTime When the document was approved
createdTime When the document was created
editedTime When the document was last modified
regNumber Document registration number only, without any additional metadata
  regNumberLong   Document registration number, including any additional metadata
edition Document edition / version number
category Category information: id, name, path
createdBy Creator: id, name
approvedBy Approver: id, name
Attachment object
Field Description
id Unique attachment ID
name Display name
filename Original file name
filesize File size in bytes
mime MIME type, for example application/zip
textContent Extracted text content, if available
downloadUrl Relative URL used to download the attachment
Linked document object
Field Description
id Unique ID of the linked document
name Display name of the linked document
documentUrl Relative URL to the linked document

Error handling

HTTP status Meaning
200 Successful request
400 Bad request, for example invalid parameters
401 Invalid or missing API key
404 Document not found
500 Internal server error

Example error response

{
  "error": {
    "code": "INVALID_PARAMETERS",
    "message": "Invalid date format in approvedTime.gte parameter"
  }
}

Rate limits

Request type Limit
Standard requests 1000 per hour / API-key
PDF generation 100 per hour / API-key
Large file downloads 50 per hour / API-key

Best practices

Use pagination. Keep response sizes manageable with page and limit.

?limit=50&page=1

Filter as specifically as possible. Tighter filters mean better performance and smaller responses.

?category.id.eq=5&approvedTime.gte=2025-01-01 

Always include an operator. A filter written without a valid operator is silently ignored, so edition.eq=5 works while edition=5 has no effect.

 

Related content: