Keap Lead Source Expenses API

Keap Lead Source Expenses API — 5 operations across 2 paths on the Keap REST v2 contract, read from Keap's own published OpenAPI 3.1 document.

OpenAPI Specification

keap-lead-source-expenses-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Keap Lead Source Expenses API
  description: Keap Public API Documentation
  termsOfService: https://www.thryv.com/terms-of-use
  contact:
    name: Keap
    url: https://developer.keap.com/get-support
    email: api.keap@thryv.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: v2
servers:
- url: https://api.infusionsoft.com/crm
tags:
- name: Lead Source Expenses
paths:
  /rest/v2/leadSources/{lead_source_id}/expenses:
    get:
      tags:
      - Lead Source Expenses
      summary: List Lead Source Expenses
      description: Retrieves a list of lead source expenses
      operationId: listLeadSourceExpenses
      parameters:
      - name: lead_source_id
        in: path
        description: The ID of the lead source this expense belongs to. Use '-' as a wildcard (e.g. /v2/leadSources/-/expenses).
        required: true
        schema:
          type: string
      - name: filter
        in: query
        description: 'Filter to apply, allowed fields are:


          - (String) `title`

          - (Long) `amount`

          - (String) `incurred_time`

          - (String) `create_time`

          - (String) `update_time`


          You will need to apply the `==` operator to check the equality of one of the filters with your
          searched

          word, in the encoded form `%3D%3D`. For the filters listed above, here are some examples:


          - `filter=amount%3D%3D2500`

          - `filter=incurred_time%3D%3D2024-12-22T01:00:00.000Z`'
        required: false
        schema:
          type: string
      - name: page_token
        in: query
        description: Page token
        required: false
        schema:
          type: string
      - name: order_by
        in: query
        description: 'Attribute and direction to order items.

          One of the following fields:


          - `title`

          - `amount`

          - `incurred_time`

          - `create_time`

          - `update_time`


          One of the following directions:

          - `asc`

          - `desc`'
        required: false
        schema:
          type: string
      - name: page_size
        in: query
        description: Total number of items to return per page
        required: false
        schema:
          type: integer
          format: int32
          maximum: 1000
          minimum: 0
        example: 0
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListLeadSourceExpensesResponse'
    post:
      tags:
      - Lead Source Expenses
      summary: Create a Lead Source Expense
      description: Creates a new Lead Source Expense
      operationId: createLeadSourceExpense
      parameters:
      - name: lead_source_id
        in: path
        description: The ID of the lead source this expense belongs to
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLeadSourceExpenseRequest'
        required: true
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadSourceExpense'
  /rest/v2/leadSources/{lead_source_id}/expenses/{lead_source_expense_id}:
    get:
      tags:
      - Lead Source Expenses
      summary: Retrieve a Lead Source Expense
      description: Retrieves a single Lead Source Expense for a given ID
      operationId: getLeadSourceExpense
      parameters:
      - name: lead_source_id
        in: path
        description: The ID of the lead source this expense belongs to
        required: true
        schema:
          type: string
      - name: lead_source_expense_id
        in: path
        description: The ID of a lead source expense
        required: true
        schema:
          type: string
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadSourceExpense'
    delete:
      tags:
      - Lead Source Expenses
      summary: Delete a lead source expense
      description: Deletes a lead source expense by ID
      operationId: deleteLeadSourceExpense
      parameters:
      - name: lead_source_id
        in: path
        description: The ID of the lead source this expense belongs to
        required: true
        schema:
          type: string
      - name: lead_source_expense_id
        in: path
        description: The ID of a lead source expense
        required: true
        schema:
          type: string
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '204':
          description: No Content
    patch:
      tags:
      - Lead Source Expenses
      summary: Update a Lead Source Expense
      description: Updates a new Lead Source Expense
      operationId: updateLeadSourceExpense
      parameters:
      - name: lead_source_id
        in: path
        description: The ID of the lead source this expense belongs to
        required: true
        schema:
          type: string
      - name: lead_source_expense_id
        in: path
        description: The ID of a lead source expense
        required: true
        schema:
          type: string
      - name: update_mask
        in: query
        description: An optional list of properties to be updated. If set, only the provided properties
          will be updated and others will be skipped.
        required: false
        schema:
          type: array
          items:
            type: string
            enum:
            - title
            - notes
            - amount
            - incurred_time
          uniqueItems: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateLeadSourceExpenseRequest'
        required: true
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadSourceExpense'
components:
  schemas:
    CreateLeadSourceExpenseRequest:
      type: object
      properties:
        title:
          type: string
          description: The title of the lead source expense
          example: Google Ads Campaign
        notes:
          type: string
          description: The notes for the lead source expense
          example: Q1 advertising spend
        amount:
          type: integer
          format: int64
          description: The cost of the lead source expense. The value should be in the smallest unit of
            currency for your currency locale. For example, if your currency locale is USD, then the smallest
            unit of currency is in cents, $225.50 would be provided in the request as 22550.
          example: 22550
          minimum: 0
        incurred_time:
          type: string
          format: date-time
          description: The time that the lead source expense was incurred.
          example: '2024-03-15T00:00:00Z'
      required:
      - amount
    CurrencyValue:
      type: object
      properties:
        amount:
          type: integer
          format: int64
          description: The price amount in the smallest currency unit
          example: 10000
        currency_code:
          type: string
          description: Three-letter ISO currency code
          example: USD
        formatted_amount:
          type: string
          description: The product amount formatted using the tenant's currency locale
          example: $100.00
    Error:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        status:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetails'
    ErrorDetails:
      type: object
      properties:
        domain:
          type: string
        resource:
          type: string
    LeadSourceExpense:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for the expense.
          example: 123
        title:
          type: string
          description: The title of the expense
          example: Google Ads Campaign
        notes:
          type: string
          description: The notes for the expense
          example: Q1 advertising spend
        amount:
          $ref: '#/components/schemas/CurrencyValue'
          description: The amount of the expense
        lead_source_id:
          type: string
          description: The ID of the lead source this expense belongs to
          example: 456
        lead_source_recurring_expense_id:
          type: string
          description: If this expense was incurred from a recurring expense, this is the ID of that recurring
            expense
          example: 789
        create_time:
          type: string
          format: date-time
          description: The date the expense was created
          example: '2024-01-10T08:00:00Z'
        update_time:
          type: string
          format: date-time
          description: The date the expense was last updated
          example: '2024-03-15T10:30:00Z'
        incurred_time:
          type: string
          format: date-time
          description: The date the expense was incurred
          example: '2024-03-15T00:00:00Z'
    ListLeadSourceExpensesResponse:
      type: object
      properties:
        lead_source_expenses:
          type: array
          description: The lead source expenses in the current page
          items:
            $ref: '#/components/schemas/LeadSourceExpense'
        next_page_token:
          type: string
    UpdateLeadSourceExpenseRequest:
      type: object
      properties:
        title:
          type: string
          description: The title of the lead source expense
          example: Google Ads Campaign
        notes:
          type: string
          description: The notes for the lead source expense
          example: Q1 advertising spend
        amount:
          type: integer
          format: int64
          description: The cost of the lead source expense. The value should be in the smallest unit of
            currency for your currency locale. For example, if your currency locale is USD, then the smallest
            unit of currency is in cents, $225.50 would be provided in the request as 22550.
          example: 22550
          minimum: 0
        incurred_time:
          type: string
          format: date-time
          description: The time that the lead source expense was incurred.
          example: '2024-03-15T00:00:00Z'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.infusionsoft.com/app/oauth/authorize
          tokenUrl: https://api.infusionsoft.com/token
          scopes: {}
security:
- oauth2: []