openapi: 3.0.0
info:
  title: 'HivePress REST API'
  description: 'This is a reference of all the endpoints available in HivePress REST API. Since it''s based on WordPress REST API, you can refer to the [WordPress documentation](https://developer.wordpress.org/rest-api/) for the available authentication methods and more details.'
  version: '1.0'
servers:
  -
    url: /wp-json/hivepress/v1
    description: ''
paths:
  /attachments:
    post:
      tags:
        - Attachments
      summary: 'Upload an attachment'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                parent:
                  description: 'Parent object ID.'
                  type: integer
                parent_model:
                  description: 'Parent model name (e.g. `user`).'
                  type: string
                parent_field:
                  description: 'Parent model field (e.g. `image`).'
                  type: string
                file:
                  description: 'File contents.'
                  type: string
                  format: file
              type: object
      responses:
        '201':
          description: ''
  '/attachments/{attachment_id}':
    post:
      tags:
        - Attachments
      summary: 'Update an attachment'
      parameters:
        -
          $ref: '#/components/parameters/attachment_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Attachment'
      responses:
        '200':
          description: ''
    delete:
      tags:
        - Attachments
      summary: 'Delete an attachment'
      parameters:
        -
          $ref: '#/components/parameters/attachment_id'
      responses:
        '204':
          description: ''
  '/listings/{listing_id}':
    post:
      tags:
        - Listings
      summary: 'Update a listing'
      description: 'In addition to the default listing fields, you can also update custom fields added via the listing attributes or HivePress extensions.'
      parameters:
        -
          $ref: '#/components/parameters/listing_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Listing'
      responses:
        '200':
          description: ''
    delete:
      tags:
        - Listings
      summary: 'Delete a listing'
      parameters:
        -
          $ref: '#/components/parameters/listing_id'
      responses:
        '204':
          description: ''
  '/listings/{listing_id}/hide':
    post:
      tags:
        - Listings
      summary: 'Hide a listing'
      description: 'Each new request hides or unhides a listing.'
      parameters:
        -
          $ref: '#/components/parameters/listing_id'
      responses:
        '200':
          description: ''
  '/listings/{listing_id}/report':
    post:
      tags:
        - Listings
      summary: 'Report a listing'
      description: 'Sends an email to the site administrator.'
      parameters:
        -
          $ref: '#/components/parameters/listing_id'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                details:
                  description: 'Report details.'
                  type: string
              type: object
      responses:
        '200':
          description: ''
  /users:
    post:
      tags:
        - Users
      summary: 'Register a user'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                username:
                  description: Username.
                  type: string
                email:
                  description: 'Email address.'
                  type: string
                password:
                  description: Password.
                  type: string
              type: object
      responses:
        '201':
          description: ''
  /users/login:
    post:
      tags:
        - Users
      summary: 'Login a user'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                username_or_email:
                  description: 'Username or email address.'
                  type: string
                password:
                  description: Password.
                  type: string
              type: object
      responses:
        '200':
          description: ''
  /users/request-password:
    post:
      tags:
        - Users
      summary: 'Request a password reset'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                username_or_email:
                  description: 'Username or email address.'
                  type: string
              type: object
      responses:
        '200':
          description: ''
  /users/reset-password:
    post:
      tags:
        - Users
      summary: 'Reset a password'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                username:
                  description: Username.
                  type: string
                password:
                  description: 'New password.'
                  type: string
                password_reset_key:
                  description: 'Password reset key.'
                  type: string
              type: object
      responses:
        '200':
          description: ''
  '/users/{user_id}':
    post:
      tags:
        - Users
      summary: 'Update a user'
      description: 'In addition to the default user fields, you can also update custom fields added via the vendor attributes or HivePress extensions.'
      parameters:
        -
          $ref: '#/components/parameters/user_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
      responses:
        '200':
          description: ''
    delete:
      tags:
        - Users
      summary: 'Delete a user'
      parameters:
        -
          $ref: '#/components/parameters/user_id'
      responses:
        '204':
          description: ''
components:
  schemas:
    Attachment:
      description: ''
      properties:
        sort_order:
          description: 'Sort order.'
          type: integer
      type: object
    Listing:
      description: ''
      properties:
        title:
          description: 'Listing title.'
          type: string
        description:
          description: 'Listing description.'
          type: string
      type: object
    User:
      description: ''
      properties:
        first_name:
          description: 'First name.'
          type: string
        last_name:
          description: 'Last name.'
          type: string
        description:
          description: 'Profile description.'
          type: string
      type: object
  parameters:
    attachment_id:
      name: attachment_id
      in: path
      description: 'Attachment ID.'
      required: true
      schema:
        type: integer
    listing_id:
      name: listing_id
      in: path
      description: 'Listing ID.'
      required: true
      schema:
        type: integer
    user_id:
      name: user_id
      in: path
      description: 'User ID.'
      required: true
      schema:
        type: integer
