Fudo Expenses API

The Expenses API from Fudo — 2 operation(s) for expenses.

OpenAPI Specification

fudo-expenses-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  version: v1alpha1
  title: Fudo Customers Expenses API
  description: "# Overview\n\n## Introduction\nThis document describes how to make use of the Fudo API. In order to use\nthe API, you must first have created an account in Fudo.\n\nYou can access the openapi spec yaml file\n[here](https://api.fu.do/v1alpha1/openapi.yml).\n\n## Authentication\nAuthentication is through an access token, sending the token in each\nrequest within the `Authorization` header. In order to obtain the token,\nyou must first have the access credentials `apiKey` and `apiSecret`.\n\n### Access credentials\nIf you do not yet have an `apiKey` and `apiSecret`, write to soporte@fu.do\nindicating the name of the account in Fudo and the user of the account to\nwhich you want to give API access.\n\nWe recommend creating a user especially for API access , in order to keep\nregular system users separated from users used for API access. E.g.\napi@mirestaurante. Keep in mind that the actions that can be done through\nthe API will depend on the role assigned to the user associated to the\ntoken.\n\n### Obtaining the token\nTo obtain the token, a request must be sent to the authentication endpoint\nwith the access credentials. It is important to send the `Content-Type`\nheader as `application/json`.\n\nThe authentication endpoint is `https://auth.fu.do/api`.\n\nExample:\n\n```terminal\ncurl -X POST https://auth.fu.do/api \\\n     -d '{\"apiKey\":\"123456\",\"apiSecret\":\"654321\"}' \\\n     -H \"Accept: application/json\" \\\n     -H \"Content-Type: application/json\"\n```\n\nAs a response, the access token will be obtained.\n\n```json\n{\"token\":\"1234567890\", exp: \"1645387452\"}\n```\n\nThe returned token will be the one that must be sent later in each request\nmade to the API, within the `Authorization` header, prefixed with the\n`Bearer` value, for example, `Authorization: Bearer 1234567890`.\n\n### Token expiration\nThe token lasts for 24 hours, after this time it can no longer be used and\na new token must be obtained. The expiration date is included in the `exp`\nattribute in the json response as an integer number of seconds since the\nEpoch.\n\nThis makes possible to know in advance when the token will expire and to\nrenew it if it has already expired at the time of using it again, or the\nexpiration date is approaching.\n\n## Pagination\nMost of the endpoints for retrieving collections (customers, sales, etc.)\naccept two query params for indicating the number of items to return (page\nsize) and the current page number (offset).\n\n- `page[size]`\n- `page[number]`\n\nBy default, the page size is 250 and the default page number is 1.\n\nCurrently, there is no way to get the total number of items. The way to get\nall the items is to keep doing requests until the number of items received\nis lower than the page size. That indicates there are no more items to\nretrieve.\n\nThe max items allowed per page is 500. In order to minimize the number of\nrequest it is possible to send this max value in the `size` param instead\nof using the default.\n\nE.g:\n\n```\nhttps://api.fu.do/v1alpha1/sales?page[size]=500&page[number]=2\n```\n"
servers:
- url: https://api.fu.do/v1alpha1
  description: Production
security:
- bearerAuth: []
tags:
- name: Expenses
paths:
  /expenses:
    get:
      summary: Get expenses
      tags:
      - Expenses
      parameters:
      - name: fields
        in: query
        description: Object in the form of fields[column]=value.
        schema:
          type: object
          additionalProperties: false
          properties:
            expense:
              type: string
              pattern: ^((amount|canceled|cashRegister|createdAt|commercialDocument|date|description|dueDate|expenseCategory|expenseItems|paymentDate|paymentMethod|payments|provider|receiptNumber|receiptType|recurringExpense|status|useInCashCount|user)(,(?!$))?)*$
              example: amount
            cashRegister:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            expenseCategory:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            paymentMethod:
              type: string
              pattern: ^((code|name)(,(?!$))?)*$
              example: name
            provider:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            receiptType:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            product:
              type: string
              pattern: ^((cost|unit|name)(,(?!$))?)*$
              example: name
            recurringExpense:
              type: string
              pattern: ^((rrule)(,(?!$))?)*$
              example: rrule
            ingredient:
              type: string
              pattern: ^((cost|unit|name)(,(?!$))?)*$
              example: name
            expenseItem:
              type: string
              pattern: ^((canceled|detail|price|product|ingredient|quantity)(,(?!$))?)*$
              example: price
            payment:
              type: string
              pattern: ^((amount|created_at|updated_at|paid_at|canceled|paymentMethod|cashRegister)(,(?!$))?)*$
            user:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            commercialDocument:
              type: string
              pattern: ^((docUrl|taxes)(,(?!$))?)*$
              example: taxes
      - name: filter
        in: query
        description: Object in the form of filter[column]=value.
        schema:
          type: object
          additionalProperties: false
          properties:
            cashRegisterId:
              type: string
              pattern: ^eq\.\d+
              example: eq.1
            canceled:
              type: string
              pattern: ^(neq|eq)\.true$
              example: neq.true
            createdAt:
              type: string
              pattern: (^gte\.\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z)?)|(^and\(gte\.\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z)?\,lte.\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z)?\))
              example: and.(gte.2020-05-11T23:15:00Z,lte.2020-05-11T23:15:00Z)
            createdById:
              type: string
              pattern: ^eq\.\d+
              example: eq.1
            date:
              type: string
              pattern: (^gte\.\d{4}-\d{2}-\d{2})|(^and\(gte\.\d{4}-\d{2}-\d{2}\,lte\.\d{4}-\d{2}-\d{2}\))
              example: and.(gte.2020-05-11,lte.2020-05-11)
            dueDate:
              type: string
              pattern: (^gte\.\d{4}-\d{2}-\d{2})|(^and\(gte\.\d{4}-\d{2}-\d{2}\,lte\.\d{4}-\d{2}-\d{2}\))
              example: and.(gte.2020-05-11,lte.2020-05-11)
            expenseCategoryId:
              type: string
              pattern: ^eq\.\d+$|^in.\(\d+(,\d+)*\)$
              example: in.(1,3,2345)
            paymentMethodId:
              type: string
              pattern: ^(eq\.\d+)|(isdistinct\.null)|(is\.null)|(and\((eq\.\d+)|(isdistinct\.null)|(is\.null)\,(eq\.\d+)|(isdistinct\.null)|(is\.null)\))$
              example: eq.1
            providerId:
              type: string
              pattern: ^eq\.\d+
              example: eq.1
            receiptTypeId:
              type: string
              pattern: ^eq\.\d+
              example: eq.1
            status:
              type: string
              enum:
              - eq.PAID
              - eq.UNPAID
            expenseCategories:
              type: object
              additionalProperties: false
              properties:
                financialCategory:
                  type: string
                  enum:
                  - eq.ADMINISTRATIVE-EXPENSES
                  - eq.OPERATIONAL-EXPENSES
                  - eq.GOODS-PURCHASES
                  - in.(ADMINISTRATIVE-EXPENSES,OPERATIONAL-EXPENSES)
            payments:
              type: object
              additionalProperties: false
              properties:
                paymentMethodId:
                  type: string
                  pattern: ^eq\.\d+$|^in.\(\d+(,\d+)*\)$
                  example: in(1,2,3)
                cashRegisterId:
                  type: string
                  pattern: ^(isdistinct\.null|eq\.\d+)$
                  example: eq.1
                canceled:
                  type: string
                  pattern: ^(neq|eq)\.true$
                  example: neq.true
                createdAt:
                  type: string
                  pattern: (^gte\.\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z)?)|(^and\(gte\.\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z)?\,lte.\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z)?\))
                  example: and.(gte.2020-05-11T23:15:00Z,lte.2020-05-11T23:15:00Z)
      - name: page
        in: query
        description: Page number and size.
        schema:
          type: object
          additionalProperties: false
          properties:
            number:
              type: string
              pattern: ^\d+$
            size:
              type: string
              pattern: ^\d+$
      - name: sort
        in: query
        description: Comma-separated list. See pattern for possible values.
        schema:
          type: string
          pattern: ^((-?id|-?createdAt|-?date|-?dueDate)(,(?!$))?)+$
          example:
          - id
          - -id
      - name: include
        in: query
        description: Comma-separated list. See pattern for possible values.
        schema:
          type: string
          pattern: ^((cashRegister|commercialDocument|expenseCategory|expenseItems|expenseItems.product|expenseItems.product.unit|expenseItems.ingredient|expenseItems.ingredient.unit|payments|payments.paymentMethod|payments.cashRegister|provider|paymentMethod|recurringExpense|user|receiptType)(,(?!$))?)+$
          example: provider,expenseCategory
      responses:
        '200':
          description: A list of resources
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          pattern: \d{1,10}
                          example: '1'
                        type:
                          type: string
                          enum:
                          - Expense
                          example: Expense
                        relationships:
                          type: object
                          properties:
                            recurringExpense:
                              type: object
                              properties:
                                data:
                                  type:
                                  - object
                                  - 'null'
                                  properties:
                                    id:
                                      type: string
                                      pattern: \d{1,10}
                                      example: '1'
                                    type:
                                      type: string
                                      enum:
                                      - RecurringExpense
                                      example: RecurringExpense
    post:
      summary: Create expense
      tags:
      - Expenses
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
              - type: object
                additionalProperties: false
                required:
                - data
                properties:
                  data:
                    type: object
                    required:
                    - type
                    - attributes
                    properties:
                      type:
                        type: string
                        enum:
                        - Expense
                        example: Expense
                      attributes:
                        type: object
                        additionalProperties: false
                        required:
                        - amount
                        - date
                        properties:
                          amount:
                            type: number
                            maximum: 99999999.99
                            minimum: 0
                            example: 100.55
                          date:
                            type: string
                            format: date
                            example: 2023-11-10
                          useInCashCount:
                            type: boolean
                            example: true
                          receiptNumber:
                            type:
                            - string
                            - 'null'
                            example: '123'
                            minLength: 1
                            maxLength: 45
                          description:
                            type: string
                            example: This is a comment
                            maxLength: 255
                          paymentDate:
                            type:
                            - string
                            - 'null'
                            format: date
                            example: 2024-11-5
                          dueDate:
                            type: string
                            format: date
                            example: 2024-11-5
                      relationships:
                        type: object
                        additionalProperties: false
                        properties:
                          expenseCategory:
                            type: object
                            additionalProperties: false
                            required:
                            - data
                            properties:
                              data:
                                type: object
                                additionalProperties: false
                                required:
                                - id
                                - type
                                properties:
                                  id:
                                    type: string
                                    pattern: ^\d{1,10}$
                                    example: '1'
                                  type:
                                    type: string
                                    enum:
                                    - ExpenseCategory
                                    example: ExpenseCategory
                          paymentMethod:
                            type: object
                            additionalProperties: false
                            required:
                            - data
                            properties:
                              data:
                                type: object
                                additionalProperties: false
                                required:
                                - id
                                - type
                                properties:
                                  id:
                                    type: string
                                    pattern: ^\d{1,10}$
                                    example: '1'
                                  type:
                                    type: string
                                    enum:
                                    - PaymentMethod
                                    example: PaymentMethod
                          commercialDocument:
                            type: object
                            additionalProperties: false
                            required:
                            - data
                            properties:
                              data:
                                type:
                                - object
                                additionalProperties: false
                                required:
                                - id
                                - type
                                properties:
                                  id:
                                    type: string
                                    pattern: ^\d{1,10}$
                                    example: '1'
                                  type:
                                    type: string
                                    enum:
                                    - CommercialDocument
                                    example: CommercialDocument
                                  lid:
                                    type: string
                                    pattern: ^\d{1,10}$
                                    example: '1'
                          provider:
                            type: object
                            additionalProperties: false
                            required:
                            - data
                            properties:
                              data:
                                type:
                                - object
                                additionalProperties: false
                                required:
                                - id
                                - type
                                properties:
                                  id:
                                    type: string
                                    pattern: ^\d{1,10}$
                                    example: '1'
                                  type:
                                    type: string
                                    enum:
                                    - Provider
                                    example: Provider
                          cashRegister:
                            type:
                            - object
                            - 'null'
                            additionalProperties: false
                            required:
                            - data
                            properties:
                              data:
                                type:
                                - object
                                - 'null'
                                additionalProperties: false
                                required:
                                - id
                                - type
                                properties:
                                  id:
                                    type: string
                                    pattern: ^\d{1,10}$
                                    example: '1'
                                  type:
                                    type: string
                                    enum:
                                    - CashRegister
                                    example: CashRegister
                          receiptType:
                            type: object
                            additionalProperties: false
                            required:
                            - data
                            properties:
                              data:
                                type:
                                - object
                                additionalProperties: false
                                required:
                                - id
                                - type
                                properties:
                                  id:
                                    type: string
                                    pattern: ^\d{1,10}$
                                    example: '1'
                                  type:
                                    type: string
                                    enum:
                                    - ReceiptType
                                    example: ReceiptType
              - type: object
                additionalProperties: false
                required:
                - bulk:data
                properties:
                  bulk:data:
                    type: array
                    items:
                      type: object
                      required:
                      - type
                      - attributes
                      properties:
                        type:
                          type: string
                          enum:
                          - Expense
                          example: Expense
                        attributes:
                          type: object
                          additionalProperties: false
                          required:
                          - amount
                          - date
                          properties:
                            amount:
                              type: number
                              maximum: 99999999.99
                              minimum: 0
                              example: 100.55
                            date:
                              type: string
                              format: date
                              example: 2023-11-10
                            useInCashCount:
                              type: boolean
                              example: true
                            receiptNumber:
                              type:
                              - string
                              - 'null'
                              example: '123'
                              minLength: 1
                              maxLength: 45
                            description:
                              type: string
                              example: This is a comment
                              maxLength: 255
                            paymentDate:
                              type:
                              - string
                              - 'null'
                              format: date
                              example: 2024-11-5
                            dueDate:
                              type: string
                              format: date
                              example: 2024-11-5
                        relationships:
                          type: object
                          additionalProperties: false
                          properties:
                            expenseCategory:
                              type: object
                              additionalProperties: false
                              required:
                              - data
                              properties:
                                data:
                                  type: object
                                  additionalProperties: false
                                  required:
                                  - id
                                  - type
                                  properties:
                                    id:
                                      type: string
                                      pattern: ^\d{1,10}$
                                      example: '1'
                                    type:
                                      type: string
                                      enum:
                                      - ExpenseCategory
                                      example: ExpenseCategory
                            paymentMethod:
                              type: object
                              additionalProperties: false
                              required:
                              - data
                              properties:
                                data:
                                  type: object
                                  additionalProperties: false
                                  required:
                                  - id
                                  - type
                                  properties:
                                    id:
                                      type: string
                                      pattern: ^\d{1,10}$
                                      example: '1'
                                    type:
                                      type: string
                                      enum:
                                      - PaymentMethod
                                      example: PaymentMethod
                            commercialDocument:
                              type: object
                              additionalProperties: false
                              required:
                              - data
                              properties:
                                data:
                                  type:
                                  - object
                                  additionalProperties: false
                                  required:
                                  - id
                                  - type
                                  properties:
                                    id:
                                      type: string
                                      pattern: ^\d{1,10}$
                                      example: '1'
                                    type:
                                      type: string
                                      enum:
                                      - CommercialDocument
                                      example: CommercialDocument
                                    lid:
                                      type: string
                                      pattern: ^\d{1,10}$
                                      example: '1'
                            provider:
                              type: object
                              additionalProperties: false
                              required:
                              - data
                              properties:
                                data:
                                  type:
                                  - object
                                  additionalProperties: false
                                  required:
                                  - id
                                  - type
                                  properties:
                                    id:
                                      type: string
                                      pattern: ^\d{1,10}$
                                      example: '1'
                                    type:
                                      type: string
                                      enum:
                                      - Provider
                                      example: Provider
                            cashRegister:
                              type:
                              - object
                              - 'null'
                              additionalProperties: false
                              required:
                              - data
                              properties:
                                data:
                                  type:
                                  - object
                                  - 'null'
                                  additionalProperties: false
                                  required:
                                  - id
                                  - type
                                  properties:
                                    id:
                                      type: string
                                      pattern: ^\d{1,10}$
                                      example: '1'
                                    type:
                                      type: string
                                      enum:
                                      - CashRegister
                                      example: CashRegister
                            receiptType:
                              type: object
                              additionalProperties: false
                              required:
                              - data
                              properties:
                                data:
                                  type:
                                  - object
                                  additionalProperties: false
                                  required:
                                  - id
                                  - type
                                  properties:
                                    id:
                                      type: string
                                      pattern: ^\d{1,10}$
                                      example: '1'
                                    type:
                                      type: string
                                      enum:
                                      - ReceiptType
                                      example: ReceiptType
      responses:
        '201':
          description: The created resource
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        pattern: \d{1,10}
                        example: '1'
                      type:
                        type: string
                        enum:
                        - Expense
                        example: Expense
                      relationships:
                        type: object
                        properties:
                          recurringExpense:
                            type: object
                            properties:
                              data:
                                type:
                                - object
                                - 'null'
                                properties:
                                  id:
                                    type: string
                                    pattern: \d{1,10}
                                    example: '1'
                                  type:
                                    type: string
                                    enum:
                                    - RecurringExpense
                                    example: RecurringExpense
  /expenses/{id}:
    get:
      summary: Get expense
      tags:
      - Expenses
      parameters:
      - name: fields
        in: query
        description: Object in the form of fields[column]=value.
        schema:
          type: object
          additionalProperties: false
          properties:
            expense:
              type: string
              pattern: ^((amount|canceled|cashRegister|createdAt|commercialDocument|date|description|dueDate|expenseCategory|expenseItems|paymentDate|paymentMethod|payments|provider|receiptNumber|receiptType|recurringExpense|status|useInCashCount|user)(,(?!$))?)*$
              example: amount
            cashRegister:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            expenseCategory:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            paymentMethod:
              type: string
              pattern: ^((code|name)(,(?!$))?)*$
              example: name
            provider:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            receiptType:
              type: string
              pattern: ^((name)(,(?!$))?)*$
              example: name
            product:
              type: string
              pattern: ^((cost|unit|name)(,(?!$))?)*$
              example: name
            recurringExpense:
              type: string
              pattern: ^((rrule)(,(?!$))?)*$
              example: rrule
            ingredient:
              type: string
              pattern: ^((cost|unit|name)(,(?!$))?)*$
              example: name
            expenseItem:
              type: string
              pattern: ^((canceled|detail|price|product|ingredient|quantity)(,(?!$))?)*$
     

# --- truncated at 32 KB (46 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/fudo/refs/heads/main/openapi/fudo-expenses-api-openapi.yml