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

# Create a billing group

> Create a billing group, to group the billing date of subscriptions. If a subscription is not assigned to a billing group, it will be charged in the billing interval from creation date.

Subscriptions which are assigned to a billing group will be charged on the billing date of the billing group with proration.



## OpenAPI

````yaml post /billing-groups
openapi: 3.1.0
info:
  title: Fynn API
  description: ''
  termsOfService: https://www.fynn.eu/tos
  contact:
    name: Fynn UG (haftungsbeschränkt)
    url: https://www.fynn.eu
    email: hi@fynn.eu
  license:
    name: Proprietary
    url: https://www.fynn.eu/license
  version: 0.0.0
servers:
  - url: https://coreapi.io
    description: Production
  - url: https://preview.coreapi.io
    description: Sandbox
security:
  - JWT: []
tags: []
paths:
  /billing-groups:
    parameters: []
    post:
      tags:
        - BillingGroup
      summary: Create a billing group
      description: >-
        Create a billing group, to group the billing date of subscriptions. If a
        subscription is not assigned to a billing group, it will be charged in
        the billing interval from creation date.


        Subscriptions which are assigned to a billing group will be charged on
        the billing date of the billing group with proration.
      operationId: createBillingGroup
      parameters: []
      requestBody:
        description: The new BillingGroup resource
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingGroup.CreateBillingGroup'
          text/html:
            schema:
              $ref: '#/components/schemas/BillingGroup.CreateBillingGroup'
        required: true
      responses:
        '201':
          description: BillingGroup resource created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingGroup-BillingGroupRead'
            text/html:
              schema:
                $ref: '#/components/schemas/BillingGroup-BillingGroupRead'
          links: {}
        '400':
          description: Invalid input
        '422':
          description: Unprocessable entity
      deprecated: false
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            curl -X POST \
             /billing-groups \
             --header "Content-Type: application/json" \
             --header "Authorization: Bearer <token>" \
             --data '{
                "customer": "ad3f4b3c-1b2a-4d5c-8e6f-7a8b9c0d1e2f",
                "name": "Billing of payments at the end of the month",
                "type": "end_of_month",
                "customDay": "31",
                "customMonth": "12"
            }'
components:
  schemas:
    BillingGroup.CreateBillingGroup:
      type: object
      description: ''
      deprecated: false
      required:
        - customer
        - name
        - type
      properties:
        customer:
          description: The customer of the billing group.
          example: ad3f4b3c-1b2a-4d5c-8e6f-7a8b9c0d1e2f
          type: string
        name:
          maxLength: 255
          description: The name of the billing group.
          example: Billing of payments at the end of the month
          type: string
        type:
          enum:
            - start_of_month
            - end_of_month
            - start_of_year
            - end_of_year
            - custom
          description: The type of the billing group.
          example: end_of_month
          type: string
        customDay:
          exclusiveMinimum: 0
          maximum: 31
          description: >-
            The custom day of the billing group, only used when type is
            "custom".
          example: 31
          type:
            - integer
            - 'null'
        customMonth:
          exclusiveMinimum: 0
          maximum: 12
          description: >-
            The custom month of the billing group, only used when type is
            "custom".
          example: 12
          type:
            - integer
            - 'null'
    BillingGroup-BillingGroupRead:
      type: object
      description: ''
      deprecated: false
      properties:
        id:
          readOnly: true
          example: 01F9ZQZJZJQZJZJZJZJZJZJZJZ
          type: string
        name:
          maxLength: 255
          description: The name of the billing group.
          example: Billing of payments at the end of the month
          type: string
        type:
          readOnly: true
          description: |-
            The type of the billing group.

            Possible values:
             * `start_of_month`: The billing group will be charged on the first day of the month.
             * `end_of_month`: The billing group will be charged on the last day of the month.
             * `start_of_year`: The billing group will be charged on the first day of the year.
             * `end_of_year`: The billing group will be charged on the last day of the year.
             * `custom`: The billing group will be charged on a custom day of the month.
          example: end_of_month
        customDay:
          exclusiveMinimum: 0
          maximum: 31
          readOnly: true
          description: >-
            The custom day of the billing group, only used when type is
            "custom".
          example: 31
          type:
            - integer
            - 'null'
        customMonth:
          exclusiveMinimum: 0
          maximum: 12
          readOnly: true
          description: >-
            The custom month of the billing group, only used when type is
            "custom".
          example: 12
          type:
            - integer
            - 'null'
      required:
        - name
        - type
  securitySchemes:
    JWT:
      type: http
      scheme: bearer

````