Read and update the current user
Fetch the authenticated user and update supported profile and credential fields.
Use these operations to fetch the user represented by a Token and to update that user's email, username, password, bio, or image. Both operations require authentication and return a user object; an update also returns a non-empty token.
Before you begin, obtain a token by registering or logging in. Send it in the Authorization header as Token <jwt>. See Authentication and token usage for the shared header format and Error envelope and HTTP status behavior for the error body.
Get current user
GET /user returns the authenticated user.
/usercurl --request GET \ --url https://api.realworld.show/api/user
{ "user": { "email": "ada@example.com", "token": "<jwt>", "username": "ada", "bio": null, "image": null } }The successful response contains user.email, user.username, user.token, and nullable user.bio and user.image fields. The Hurl suite verifies that the token is a non-empty string.
curl --request GET \
--url https://api.realworld.show/api/user \
--header 'Authorization: Token <jwt>'Update current user
PUT /user accepts a JSON object containing user. Include at least one field inside user; all fields are optional individually.
/userObject containing one or more update fields.
New email address. It must not be empty or null.
New username. It must not be empty or null.
New password. The tested minimum length is 8 characters.
Biography. An empty string is normalized to null.
Image URL or null.
curl --request PUT \
--url https://api.realworld.show/api/user \
--header 'Content-Type: application/json' \
--data '{
"user": {},
"user.email": "<string>",
"user.username": "<string>",
"user.password": "<string>",
"user.bio": "<string>",
"user.image": "<string>"
}'{ "user": { "email": "ada@example.com", "token": "<new-or-current-jwt>", "username": "ada", "bio": "Updated bio", "image": null } }Send the request body under the user key. Keep the returned token for subsequent requests because the update response supplies a token that clients should use afterward.
curl --request PUT \
--url https://api.realworld.show/api/user \
--header 'Authorization: Token <jwt>' \
--header 'Content-Type: application/json' \
--data '{"user":{"bio":"Updated bio","image":null}}'The tested behavior is:
| Field | Accepted update behavior |
|---|---|
email | A non-empty, non-null string. |
username | A non-empty, non-null string. |
password | At least 8 characters; 8 and 64 characters are accepted by the suite. |
bio | A string or null; "" is returned and persisted as null. |
image | A string or null; the suite verifies nullability. |
After a successful update, call GET /user with the returned token and confirm that the changed field is present. The Hurl suite verifies that a bio update persists and that an empty bio remains null after a later read.
For the shared user and response shapes, see Response envelopes and resource models. Continue with Profiles, follow, and unfollow to apply the authenticated user's social-graph state.