openapi: 3.0.3

info:
  title: Phone Records
  description: "Use this endpoint to manage the phone records of participants to a matter. For information on how to construct requests utilising fieldsets, sorting, paging, filters, and '*includes*', please refer to the API Developer Portal. E&OE."
  version: "1.0"

paths:
  '/phonerecords':
    get:
      description: Returns the collection of all phone records.
      tags:
        - Phone Records
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedPhoneRecords'

    post:
      description: Create a new phone record.
      tags:
        - Phone Records
      requestBody:
        $ref: '#/components/requestBodies/CreatePhoneRecord'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneRecord'

  '/phonerecords/{id}':
    get:
      description: Returns a single phone record.
      tags:
        - Phone Records
      parameters:
        - name: id
          in: path
          description: Unique identifier for a single phone record.
          required: true
          schema:
            type: integer
            format: integer
          example: 1176
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneRecord'

    put:
      description: Updates a single phone record.
      tags:
        - Phone Records
      parameters:
        - name: id
          in: path
          description: Unique identifier for a single phone record.
          required: true
          schema:
            type: integer
            format: integer
          example: 1176
      requestBody:
        $ref: '#/components/requestBodies/UpdatePhoneRecord'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneRecord'

    delete:
      description: Delete a single phone record.
      tags:
        - Phone Records
      parameters:
        - name: id
          in: path
          description: Unique identifier for a single phone record.
          required: true
          schema:
            type: integer
            format: integer
          example: 1176
      responses:
        '204':
          description: Success, No Content.

components:
  schemas:
    PagedPhoneRecords:
      type: object
      properties:
        phonerecords:
          type: array
          items:
            $ref: '#/components/schemas/PhoneRecord'
        meta:
          $ref: '#/components/schemas/PageMetaData'

    PageMetaData:
      type: object
      properties:
        paging:
          $ref: '#/components/schemas/PagingData'

    PagingData:
      type: object
      properties:
        phonerecords:
          $ref: '#/components/schemas/PhoneRecordPageData'

    PhoneRecordPageData:
      type: object
      properties:
        recordCount:
          description: The total number of phone records returned by the underlying query.
          type: integer
          example: 2487
        pageCount:
          description: The total number of pages generated by the underlying query.
          type: integer
          example: 50
        page:
          description: The page number for this page of phone records.
          type: integer
          example: 2
        pageSize:
          description: Page size.
          type: integer
          example: 50
        prevPage:
          description: A URL to the previous page of phone records.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/phonerecords?page=1
        nextPage:
          description: A URL to the next page of phone records.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/phonerecords?page=3

    PhoneRecord:
      type: object
      properties:
        id:
          description: Unique identifier for a phone record. 
          type: integer
          format: integer
          example: 1176
          readOnly: true
        fromParticipantOther:
          description: Used to record the name of an individual or company not held in Actionstep for an incoming call.
          type: string
          format: string
          example: John Smith
        toParticipantOther:
          description: Used to record the name of an individual or company not held in Actionstep for an outgoing call.
          type: string
          format: string
          example: AJ Accountants LLC
        direction:
          description: Direction of the call.
          enum:
          - in
          - out
          type: string
          format: string
          example: out
        phoneNumber:
          description: Phone number.
          type: string
          format: string
          example: +44 493 993938
        phoneNumberType:
          description: A type associated to the phone number.
          type: string
          format: string
          example: Business
        actualHours:
          description: The duration of the call measured in hours.
          type: number
          format: string
          example: 0.25
        notes:
          description: Notes taken from the call.
          type: string
          format: string
          example: Discussed progress for this week.
        callTimestamp:
          description: Date and time of the phone call.
          type: string
          format: timestamp
          example: 2025-09-17T09:12:32+12:00
        outcome:
          description: Indicates the outcome for the call.
          type: string
          format: string
          example: Call completed
        links:
          $ref: '#/components/schemas/PhoneRecordLinks'

    PhoneRecordLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the matter to which the phone record is associated.
          example: 321845
          type: integer
        fromParticipant:
          description: Unique identifier for a participant from whom the call was received.
          example: 8945
          type: integer
        toParticipant:
          description: Unique identifier for a participant to whom the call was made.
          example: 4912
          type: integer

    CreatePhoneRecord:
      type: object
      required:
        - direction
        - callTimestamp
        - outcome
      properties:
        fromParticipantOther:
          description: Used to record the name of an individual or company not held in Actionstep for an incoming call.
          type: string
          format: string
          example: John Smith
        toParticipantOther:
          description: Used to record the name of an individual or company not held in Actionstep for an outgoing call.
          type: string
          format: string
          example: AJ Accountants LLC
        direction:
          description: Direction of the call.
          enum:
          - in
          - out
          type: string
          format: string
          example: out
        phoneNumber:
          description: Phone number.
          type: string
          format: string
          example: +44 493 993938
        phoneNumberType:
          description: A type associated to the phone number.
          type: string
          format: string
          example: Business
        actualHours:
          description: The duration of the call measured in hours.
          type: number
          format: string
          example: 0.25
        notes:
          description: Notes taken from the call.
          type: string
          format: string
          example: Discussed progress for this week.
        callTimestamp:
          description: Date and time of the phone call.
          type: string
          format: timestamp
          example: 2025-09-17T09:12:32+12:00
        outcome:
          description: Indicates the outcome for the call.
          type: string
          format: string
          example: Call completed
        links:
          $ref: '#/components/schemas/CreatePhoneRecordLinks'

    CreatePhoneRecordLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the matter to which the phone record is associated.
          example: 321845
          type: integer
        fromParticipant:
          description: Unique identifier for a participant from whom the call was received.
          example: 8945
          type: integer
        toParticipant:
          description: Unique identifier for a participant to whom the call was made.
          example: 4912
          type: integer

    UpdatePhoneRecord:
      type: object
      properties:
        fromParticipantOther:
          description: Used to record the name of an individual or company not held in Actionstep for an incoming call.
          type: string
          format: string
          example: John Smith
        toParticipantOther:
          description: Used to record the name of an individual or company not held in Actionstep for an outgoing call.
          type: string
          format: string
          example: AJ Accountants LLC
        direction:
          description: Direction of the call.
          enum:
          - in
          - out
          type: string
          format: string
          example: out
        phoneNumber:
          description: Phone number.
          type: string
          format: string
          example: +44 493 993938
        phoneNumberType:
          description: A type associated to the phone number.
          type: string
          format: string
          example: Business
        actualHours:
          description: The duration of the call measured in hours.
          type: number
          format: string
          example: 0.25
        notes:
          description: Notes taken from the call.
          type: string
          format: string
          example: Discussed progress for this week.
        callTimestamp:
          description: Date and time of the phone call.
          type: string
          format: timestamp
          example: 2025-09-17T09:12:32+12:00
        outcome:
          description: Indicates the outcome for the call.
          type: string
          format: string
          example: Call completed
        links:
          $ref: '#/components/schemas/UpdatePhoneRecordLinks'

    UpdatePhoneRecordLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the matter to which the phone record is associated.
          example: 321845
          type: integer
        fromParticipant:
          description: Unique identifier for a participant from whom the call was received.
          example: 8945
          type: integer
        toParticipant:
          description: Unique identifier for a participant to whom the call was made.
          example: 4912
          type: integer

  requestBodies:
    CreatePhoneRecord:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreatePhoneRecord'

    UpdatePhoneRecord:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdatePhoneRecord'
