The IMAP Response Codes Reference is a searchable lookup for the status responses and bracketed response codes that an IMAP4rev1 server sends. IMAP responses are richer than a single numeric code — they pair a human-readable status word with an optional machine-readable code in square brackets that allows client software to take the right action automatically.
IMAP response anatomy
IMAP4rev1 (RFC 3501) and IMAP4rev2 (RFC 9051) structure every server message as one of three types:
Tagged response: A001 OK LOGIN completed
^tag ^status ^human text
Untagged response: * 23 EXISTS
^ ^count ^data type
Status + code: * OK [UIDVALIDITY 1234567890] SELECT completed
^bracketed response code
Tagged responses end a specific client command identified by the tag (A001,
B003, etc.). Untagged responses carry server-pushed data (message counts,
flags, FETCH results) and can arrive at any time. Greeting and BYE are
special forms of untagged response.
The five status words
| Status | Meaning |
|---|---|
OK | Command succeeded. May carry a response code with detail. |
NO | Operational failure. The command syntax was valid but the server cannot complete it. |
BAD | Protocol error. The command was syntactically invalid or the server encountered an internal error. |
PREAUTH | Sent as a greeting. The connection is already authenticated (e.g. via a trusted IP or certificate). |
BYE | The server is closing the connection. Normally preceded by a human-readable reason. |
Key bracketed response codes
The machine-readable codes in square brackets let client software handle failures programmatically rather than parsing English text:
| Code | Typical status | Meaning and client action |
|---|---|---|
TRYCREATE | NO | APPEND or COPY failed because the mailbox does not exist. Create it and retry. |
READ-ONLY | OK | Mailbox was opened but is read-only. Do not send STORE or EXPUNGE. |
READ-WRITE | OK | Mailbox was opened with full write access. |
UIDVALIDITY n | OK | Every SELECT/EXAMINE returns this. If it changes, discard all cached UIDs. |
UIDNEXT n | OK | The UID the server plans to assign to the next message. |
OVERQUOTA | NO | APPEND failed because the mailbox is over quota. |
AUTHENTICATIONFAILED | NO | Credentials were wrong or auth mechanism unsupported. |
ALERT | OK/NO/BAD | RFC requires this text be surfaced verbatim to the user. |
PARSE | NO/BAD | The server could not parse the RFC 2822 headers of a message. |
Debugging an IMAP session
When you see a NO response, do not stop at the status word — look for the
bracketed code. A NO [TRYCREATE] and a NO [OVERQUOTA] are both NO but
require completely different responses from the client:
TRYCREATE: issueCREATE mailbox-namethen retry the COPY or APPEND.OVERQUOTA: the user must delete messages; the client should surface a quota warning.
If no code appears, the human text is all you have. BAD almost always
indicates a client bug (malformed command, wrong argument count, illegal
character in a mailbox name) rather than a server or user issue.
Search by token name in the tool above — results filter as you type, covering both status responses and bracketed codes from RFC 3501 and RFC 9051.