Skip to main content
REST API

409 Conflict

ErrorValidateRequestMedium

What you will learn

  • 409 Conflict fires on state-dependent failures (duplicate email, version mismatch on update) โ€” distinct from 400 Bad Request (malformed input)
  • On optimistic-concurrency 409, return the current version/ETag so the client can retry after re-fetch
  • Test from concurrent clients โ€” 409 must fire for exactly one (the loser), the other succeeds

Description

Handle resource conflicts like duplicate email.

Test Scenario

// Create user with existing email
const response = await request.post('/api/v1/users', {
  data: { email: 'existing@test.com', name: 'Test' }
});
expect(response.status()).toBe(409);
Endpoint/api/v1/errors/409

Testing Tips

  • โ€ขCreate duplicate resource
  • โ€ขCheck conflict field in error
  • โ€ขCommon for unique constraints
// Playwright API Testing - REST
import { test, expect } from '@playwright/test';
test('REST API request', async ({ request }) => {
const response = await request.get('/api/v1/resource');
expect(response.ok()).toBeTruthy();
expect(response.status()).toBe(200);
const data = await response.json();
expect(data).toBeDefined();
});

Challenge ID: rest-error-409

2 frameworks available

API Playground

Send requests and inspect responses

Endpoint: /api/v1/errors/409

Press Enter to send