0PricingLogin
Flask Academy · Lesson

Set Status Codes on JSON Replies

Pair JSON bodies with 201, 404, and friends.

Status Codes Tell the Story

Every HTTP response carries a status code that signals success or failure. Your JSON body explains the details, but the code sets the tone first. 🚦

The Default Is 200

When you return jsonify alone, Flask sends 200 OK. That is perfect for a successful read, but other actions deserve their own code.

All lessons in this course

  1. jsonify a Dictionary
  2. Return Lists and Nested Data
  3. Set Status Codes on JSON Replies
  4. Content-Type and the Accept Header
← Back to Flask Academy