> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uk.housr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a property

> Creates a new property record




## OpenAPI

````yaml openapi.yaml post /create-property
openapi: 3.1.0
info:
  title: Housr API
  version: 1.0.0
  summary: Property management API with hourly-expiring bearer token authentication.
  description: >
    This API provides endpoints for managing properties in the Housr platform.
    It issues an hourly-expiring bearer token via HTTP Basic Auth for secure
    access. Unless otherwise noted, all endpoints require `Authorization: Bearer
    <token>` over HTTPS.


    ## Endpoints


    ### Health Check

    - `GET /health-check` - Check API service availability (no authentication
    required)


    ### Authentication

    - `POST /auth/token` - Obtain a bearer token using HTTP Basic Auth
      - Token expires in 1 hour by default
      - Token provides access based on client credentials and associated scopes

    ### Properties

    - `GET /get-property/{propertyId}` - Retrieve a property by ID
      - Requires bearer token authentication
    - `POST /create-property` - Create a new property record
      - Requires `properties:write` scope
      - Accepts JSON or form-encoded data
      - Supports image URLs as array or comma-separated string
    - `PATCH /update-property/{propertyId}` - Update an existing property
      - Requires `properties:write` scope
      - Server enforces ownership/permissions
      - Provide only fields you wish to change
    - `DELETE /delete-property/{propertyId}` - Delete a property
      - Requires `properties:delete` scope
      - Server enforces ownership/permissions

    ## Authentication

    - Obtain a token with Basic Auth to `/auth/token`.

    - Token expires in 1 hour by default.

    - Use the token in subsequent requests: `Authorization: Bearer <token>`


    ## Error Responses

    All error responses follow the `application/problem+json` format with a
    `response` field containing the error message. Validation errors include an
    additional `errors` object with field-specific error arrays.
servers:
  - url: https://v2.api.uk.housr.com
    description: Production
  - url: https://v2.staging.api.uk.housr.com
    description: Sandbox
security:
  - bearerAuth: []
tags:
  - name: Auth
  - name: Properties
  - name: Health Check
paths:
  /create-property:
    post:
      tags:
        - Properties
      summary: Create a property
      description: |
        Creates a new property record
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PropertyCreate'
            examples:
              json-array:
                value:
                  title: Spacious 4-bed near campus
                  description: Modern kitchen, large garden.
                  address: 12 Oxford Road
                  city: Manchester
                  images:
                    - https://cdn.example.com/img/1.jpg
                    - https://cdn.example.com/img/2.jpg
                  price_pw: 180
                  bedrooms: 4
                  bathrooms: 2
                  postcode: M13 9PL
                  number_available: 1
                  lat: 53.467
                  lng: -2.233
                  deposit: 200
              csv-images:
                value:
                  title: Studio flat
                  description: Bills included.
                  address: 2A King St
                  city: Leeds
                  images: https://cdn.x/1.jpg, https://cdn.x/2.jpg
                  price_pw: 145
                  bedrooms: 1
                  bathrooms: 1
                  postcode: LS1 2AB
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PropertyCreateFormCompatible'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PropertyCreateResponse'
              examples:
                created:
                  value:
                    propertyId: 12345
                    message: Property successfully uploaded
        '400':
          description: Bad request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                bad_request:
                  value:
                    response: Invalid JSON in request body
        '401':
          description: Missing or invalid authentication
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthorized:
                  value:
                    response: Missing or invalid authentication token
        '422':
          description: Validation errors
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ValidationProblem'
              examples:
                validation_error:
                  value:
                    response: Validation failed
                    errors:
                      title:
                        - Title cannot be empty
                      price_pw:
                        - Price must be a positive number
      security:
        - bearerAuth: []
components:
  schemas:
    PropertyCreate:
      allOf:
        - $ref: '#/components/schemas/PropertyBase'
        - type: object
          required:
            - title
            - description
            - address
            - city
            - images
            - price_pw
            - bedrooms
            - bathrooms
            - postcode
            - lat
            - lng
            - deposit
    PropertyCreateFormCompatible:
      type: object
      required:
        - title
        - description
        - address
        - city
        - images
        - price_pw
        - bedrooms
        - bathrooms
        - postcode
        - lat
        - lng
        - deposit
      properties:
        title:
          type: string
        description:
          type: string
        address:
          type: string
        city:
          type: string
        images:
          type: string
          description: Comma-separated image URLs
        price_pw:
          type: integer
        bedrooms:
          type: integer
        bathrooms:
          type: integer
        postcode:
          type: string
        lat:
          type: number
          format: double
        lng:
          type: number
          format: double
        deposit:
          type: integer
          default: 0
    PropertyCreateResponse:
      type: object
      properties:
        propertyId:
          type: integer
          format: int64
        message:
          type: string
    Problem:
      type: object
      properties:
        response:
          type: string
    ValidationProblem:
      allOf:
        - $ref: '#/components/schemas/Problem'
        - type: object
          properties:
            errors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
    PropertyBase:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        address:
          type: string
        city:
          type: string
        images:
          type: array
          items:
            type: string
            format: uri
          description: Array of image URLs, each their own comma-separated string
        price_pw:
          type: integer
          description: Weekly price as a string to preserve precision
        bedrooms:
          type: integer
          minimum: 0
        bathrooms:
          type: integer
          minimum: 0
        postcode:
          type: string
        lat:
          type: number
          format: double
          nullable: true
        lng:
          type: number
          format: double
          nullable: true
        deposit:
          type: integer
          default: 0
          description: Defaults to 0 if not supplied
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````