---
title: "Create a new region"
method: POST
path: "/regions"
tags: ["region"]
---

# Create a new region

`POST /regions`

## Request

- Base URL: `https://staging.api-golang.boilerplate.hng.tech/api/v1`
- URL: `https://staging.api-golang.boilerplate.hng.tech/api/v1/regions`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/hngprojects/apis/kimiko-golang-swagger/docs/regions/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new region entry.

## Request body

- RegionSchema
  - `name` string
  - `code` string

## Response `201`

Region created successfully

- SuccessResponseSchema2
  - `status` string
  - `status_code` integer: The HTTP status code. Usually 200 , 201, 204 etc
  - `message` string: A basic message describing a request was processed successfully. example: "Successfully"

## Other responses

- `400`: Bad Request
- `401`: Authentication error
- `422`: Validation error
- `500`: Server error

## Changes

- **2024-08-07** `f777e29f0ee3`: 1 info
  - added the non-success response with the status `422`
- **2024-08-07** `06cecc2ac126`: 1 info
  - removed the non-success response with the status `422`

[Operation history](https://skmtc.dev/hngprojects/apis/kimiko-golang-swagger/changes/regions/post.md)

---

[API](https://skmtc.dev/hngprojects/apis/kimiko-golang-swagger.md) - [All operations](https://skmtc.dev/hngprojects/apis/kimiko-golang-swagger/llms.txt) - [OpenAPI document](https://skmtc.dev/hngprojects/apis/kimiko-golang-swagger/revisions/2d1d3ed96bb9?raw)
