200

OK

2xx · Success common

Overview

200 OK is the most basic and common status code, signaling that the request succeeded. The meaning of the response body depends on the method: for GET it is the fetched resource, for POST/PUT it is the result of the operation.

Most normal web requests return this code — it reports success while also delivering the actual data (use 204 for a success with no body).

When it happens

Request / Response example

Request
GET /api/users/42 HTTP/1.1
Host: api.example.com
Accept: application/json
Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 51

{"id":42,"name":"Ada Lovelace","role":"admin"}

In code

app.get('/api/users/:id', (req, res) => {
  res.status(200).json({ id: req.params.id, name: 'Ada' });
});
@app.get('/api/users/<int:uid>')
def user(uid):
    return {'id': uid, 'name': 'Ada'}, 200

Notes

Related status codes

Related headers

Specification