Skip to main content
List endpoints in Memic use page-based pagination with page and page_size query parameters. The response includes enough metadata to know whether more pages exist.

Request

curl "https://api.memic.ai/api/v1/files?page=1&page_size=50" \
  -H "X-API-Key: mk_live_..."

Query parameters

ParameterTypeDefaultMaxDescription
pageinteger11-indexed page number
page_sizeinteger50100Items per page

Response shape

{
  "items": [
    { "id": "...", "name": "contract.pdf", ... },
    { "id": "...", "name": "handbook.md", ... }
  ],
  "total": 237,
  "page": 1,
  "page_size": 50,
  "has_more": true
}
  • items — the array of results for the current page
  • total — total count across all pages
  • page — the page you requested (echoed back)
  • page_size — the page size you requested (echoed back)
  • has_moretrue if another page exists

Iterating through all pages

Python (using the SDK)

from memic import Memic

client = Memic()

for file in client.files.iter_all():
    print(file.name)
The SDK handles pagination transparently via a generator. Use this when you need to process every file without thinking about pages.

Python (manual)

page = 1
while True:
    response = client.files.list(page=page, page_size=100)
    for file in response.items:
        print(file.name)
    if not response.has_more:
        break
    page += 1

cURL (bash)

page=1
while :; do
  resp=$(curl -s "$MEMIC_BASE_URL/files?page=$page&page_size=100" \
    -H "X-API-Key: $MEMIC_API_KEY")
  echo "$resp" | jq -r '.items[].name'
  if [[ $(echo "$resp" | jq '.has_more') != "true" ]]; then
    break
  fi
  page=$((page + 1))
done

Best practices

  • Prefer page_size=100 (the maximum) to reduce the number of round-trips
  • Don’t re-fetch old pages if you’re only looking for new items — keep a local cursor of the highest created_at you’ve seen and filter client-side
  • Use the SDK’s iterator when you need to process everything — it handles pagination correctly even if items shift between pages due to concurrent writes