# Response Status Code Example

> Learn how to set custom HTTP status codes (like 200, 404, 500) using g.res.statusCode in API Maker with sample usage shown.

Source: https://docs.apimaker.dev/v1/examples/res/status-code/statusCode.html

### HTTP status code

`statusCode` use to set/get status code of the response.
```ts
g.res.statusCode = T.EStatusCode.BAD_REQUEST;
```

Response
```json
{
    "success": false,
    "statusCode": 400,
    "data": 400
}
```

All supported status code.
```text
OK = 200,
NO_CONTENT = 204,
CREATED = 201,
BAD_REQUEST = 400,
UNAUTHORIZED = 401,
FORBIDDEN = 403,
RESOURCE_NOT_FOUND = 404,
INTERNAL_SERVER_ERROR = 500
```

## Related

- [The global object g](https://docs.apimaker.dev/v1/docs/pre-defined-terms/global-object-g.html) · [Custom APIs](https://docs.apimaker.dev/v1/docs/apis-all/custom-apis/user-created-custom-api.html)
