Skip to content

feat(api): add GET /v1/activity endpoint for listing recent jobs#3160

Open
firecrawl-spring[bot] wants to merge 4 commits intomainfrom
feat/activity-api
Open

feat(api): add GET /v1/activity endpoint for listing recent jobs#3160
firecrawl-spring[bot] wants to merge 4 commits intomainfrom
feat/activity-api

Conversation

@firecrawl-spring
Copy link
Contributor

@firecrawl-spring firecrawl-spring bot commented Mar 16, 2026

Summary

  • Adds GET /v1/activity endpoint that lists a team's recent API activity (last 24 hours)
  • Supports cursor-based pagination using UUIDv7 job IDs as cursors
  • Supports filtering by endpoint (scrape, crawl, batch_scrape, search, extract, etc.)
  • Returns basic metadata: id, endpoint, api_version, created_at, target
  • Queries the requests table directly using the existing (team_id, created_at DESC) index
  • Respects zero data retention — returns 403 for ZDR teams

Motivation

Customers who lose local data (machine crash, etc.) currently have no way to discover job IDs to re-download results from past scrapes/crawls. This endpoint enables discovery of recent job IDs, which can then be used with existing GET endpoints (/v1/crawl/{id}, /v1/batch/scrape/{id}, /v1/scrape/{id}, etc.) to retrieve results.

API

GET /v1/activity?endpoint=crawl&limit=50
GET /v1/activity?endpoint=crawl&limit=50&cursor=01958abc-...
{
  "success": true,
  "data": [
    {
      "id": "01958abc-...",
      "endpoint": "crawl",
      "api_version": "v1",
      "created_at": "2026-03-13T16:04:08Z",
      "target": "https://example.com"
    }
  ],
  "cursor": "01958aaa-...",
  "has_more": true
}

Test plan

  • Test with API key: GET /v1/activity returns recent jobs for the authenticated team
  • Test pagination: cursor from first page works for second page
  • Test endpoint filter: ?endpoint=crawl only returns crawl jobs
  • Test limit param: respects limit, caps at 100
  • Test ZDR team: returns 403
  • Test empty result: new team with no activity returns empty array
  • Verify returned id values work with existing GET endpoints (e.g. /v1/crawl/{id})

Adds a new endpoint that lets users list their recent API activity
(last 24 hours) with cursor-based pagination. This enables users to
discover job IDs for past scrapes, crawls, batch scrapes, etc. so
they can retrieve results via existing GET endpoints.

Co-Authored-By: micahstairs <micah@sideguide.dev>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/api/src/controllers/v1/activity.ts">

<violation number="1" location="apps/api/src/controllers/v1/activity.ts:19">
P2: Add `browser` to `VALID_KINDS`; the current filter rejects a real activity kind.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

- Remove ZDR 403 check (not needed for metadata-only endpoint)
- Add new RateLimiterMode.Account (100 req/min) for all account
  endpoints instead of reusing CrawlStatus
- Rename query param from next_cursor to cursor

Co-Authored-By: micahstairs <micah@sideguide.dev>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 5 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/api/src/controllers/v1/activity.ts">

<violation number="1" location="apps/api/src/controllers/v1/activity.ts:66">
P1: Read `next_cursor` from the query string so the returned pagination token can be used for the next page.</violation>
</file>

<file name="apps/api/src/routes/v1.ts">

<violation number="1" location="apps/api/src/routes/v1.ts:287">
P2: Switching these read endpoints to `RateLimiterMode.Account` sharply reduces their allowed request rate, so existing polling/usage clients can start getting unexpected 429s.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@blacksmith-sh

This comment has been minimized.

- Bump Account rate limit from 100 to 1000 req/min
- Add 'browser' to VALID_KINDS for activity filtering
- Remove origin and integration from activity response

Co-Authored-By: micahstairs <micah@sideguide.dev>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/api/src/controllers/v1/activity.ts">

<violation number="1" location="apps/api/src/controllers/v1/activity.ts:74">
P2: This drops `origin` and `integration` from `/v1/activity`, so the implementation no longer matches the documented response schema.</violation>
</file>

<file name="apps/api/src/services/rate-limiter.ts">

<violation number="1" location="apps/api/src/services/rate-limiter.ts:32">
P2: This raises the default Account limiter to 1000 req/min instead of the intended 100 req/min, weakening protection for account-scoped endpoints when no explicit account limit is present.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@firecrawl firecrawl deleted a comment from cubic-dev-ai bot Mar 18, 2026
- Rename `kind` query param and response field to `endpoint` for clarity
- Rename `next_cursor` response field to `cursor` to match the query param

Co-Authored-By: micahstairs <micah@sideguide.dev>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/api/src/controllers/v1/activity.ts">

<violation number="1" location="apps/api/src/controllers/v1/activity.ts:51">
P2: The endpoint now reads `endpoint` instead of the documented `kind` query param, so clients using `?kind=...` won’t get filtered results.</violation>

<violation number="2" location="apps/api/src/controllers/v1/activity.ts:103">
P2: Response fields were renamed to `endpoint` and `cursor`, but the documented API uses `kind` and `next_cursor`. This is a breaking change for clients expecting the documented shape.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants