---     
tags: 
  - Regions
description: Creates a new region and returns its ID.
parameters:
  - in: header
    name: Authorization
    type: string
    required: true
  - in: body
    name: body
    type: object
    required: true
    schema: {
      'name': 'Test Region', 
      'region_polygon': '{"type": "Polygon", "coordinates": [[[-0.63720703125, 51.19812101610383], [-0.63720703125, 51.275504932210275], [-0.490264892578125, 51.275504932210275], [-0.490264892578125, 51.19812101610383], [-0.63720703125, 51.19812101610383]]]}', 
      'renderable': True, 
      'enabled': True, 
      'style': {
        'fill_opacity': 0.1, 
        'fill_colour': '#000000', 
        'border_weight': 5, 
        'border_opacity': 0.7, 
        'border_colour': '#0000FF'
      }, 
      'created_by_id': 18855, 
      'expires_at': '20240923'
    }
produces: 
  - 'application/json'
responses:
  201:
    schema:
      type: object
      example: {
        "message": "region created",
        "id": 1
      }
  400:
    schema:
      type: object
      properties:
        error:
          type: string
          example: {
            "message": "invalid polygon"
          }
  401:
    schema:
      type: object
      properties:
        error:
          type: string
          example: 'Unauthorised'