Use HTTP status codes that accurately reflect the outcome of API operations. This improves API clarity and allows client applications to handle responses more intelligently.

Example for duplicate resources:

// For duplicate resource detection:
- expect(response.status).toBe(404);
+ expect(response.status).toBe(409);

Example for asynchronous processing:

PATCH: createAuthedAPIRoute({
  name: "Update Single Trace",
  // ...
  fn: async ({ query, body, auth }) => {
    // Process the request...
    
    // Return 202 Accepted for async processing
    return { status: 202, body: { 
      message: "Update accepted and will be processed" 
    }};
  }
})