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

# Create a package

> Create a package. <h3>OAuth</h3>Required scopes: <code>invoices</code>



## OpenAPI

````yaml /assets/openapi.json post /packages/v1
openapi: 3.0.2
info:
  title: Spacebring
  version: 1.0.0
  termsOfService: https://www.spacebring.com/terms
servers:
  - url: https://api.spacebring.com
security: []
paths:
  /packages/v1:
    post:
      tags:
        - Packages
      summary: Create a package
      description: 'Create a package. <h3>OAuth</h3>Required scopes: <code>invoices</code>'
      operationId: createPackage
      parameters:
        - in: header
          name: spacebring-network-id
          schema:
            type: string
            format: uuid
          required: false
          description: >-
            The id of the network. Required when using bearer token
            authentication
      requestBody:
        $ref: '#/components/requestBodies/createPackage'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getPackage'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseError'
      security:
        - BasicAuth: []
        - OAuth2:
            - invoices
components:
  requestBodies:
    createPackage:
      content:
        application/json:
          schema:
            type: object
            properties:
              package:
                type: object
                properties:
                  grants:
                    minItems: 1
                    type: array
                    items:
                      type: object
                      properties:
                        amount:
                          type: number
                          minimum: 0
                          exclusiveMinimum: true
                          maximum: 1000000000
                          description: >-
                            Grant amount in major units for credits, or whole
                            units for day passes.
                        duration:
                          description: Expiration duration in days for credit grants.
                          anyOf:
                            - type: number
                              enum:
                                - 30
                            - type: number
                              enum:
                                - 90
                            - type: number
                              enum:
                                - 180
                            - type: number
                              enum:
                                - 365
                        type:
                          type: string
                          enum:
                            - credits
                            - dayPasses
                          description: Type of balance this grant provides.
                      required:
                        - amount
                        - type
                    description: Grants included in the package.
                  locationRef:
                    type: string
                    format: uuid
                    description: ID of the location where to create this package.
                  price:
                    type: number
                    minimum: 0
                    exclusiveMinimum: true
                    maximum: 9007199254740991
                    description: Package price in major units.
                required:
                  - grants
                  - locationRef
                  - price
                description: Package to create.
            required:
              - package
      required: true
  schemas:
    getPackage:
      type: object
      properties:
        package:
          type: object
          properties:
            amount:
              type: number
              deprecated: true
              description: >-
                Total credits amount derived from grants. Deprecated: use grants
                instead.
            duration:
              deprecated: true
              description: >-
                Maximum credit grant duration in days. Deprecated: use grants
                instead.
              anyOf:
                - type: number
                  enum:
                    - 30
                - type: number
                  enum:
                    - 90
                - type: number
                  enum:
                    - 180
                - type: number
                  enum:
                    - 365
            grants:
              type: array
              items:
                type: object
                properties:
                  amount:
                    type: number
                    description: >-
                      Grant amount in major units for credits, or whole units
                      for day passes.
                  duration:
                    description: Expiration duration in days for credit grants.
                    anyOf:
                      - type: number
                        enum:
                          - 30
                      - type: number
                        enum:
                          - 90
                      - type: number
                        enum:
                          - 180
                      - type: number
                        enum:
                          - 365
                  id:
                    type: string
                    format: uuid
                    description: Unique identifier of the grant.
                  type:
                    type: string
                    enum:
                      - credits
                      - dayPasses
                    description: Type of balance this grant provides.
                required:
                  - amount
                  - id
                  - type
                additionalProperties: false
              description: Grants included in the package.
            id:
              type: string
              format: uuid
              description: Unique identifier of the package.
            locationRef:
              type: string
              format: uuid
              description: ID of the location this package belongs to.
            networkRef:
              type: string
              format: uuid
              description: ID of the network this package belongs to.
            organizationRef:
              type: string
              format: uuid
              deprecated: true
              description: >-
                ID of the location this package belongs to. Deprecated: use
                locationRef instead.
            price:
              type: number
              description: Package list price in major units.
            priceDiscounted:
              type: number
              deprecated: true
              description: >-
                Discounted price visible to members. Deprecated: equals price
                since 4.8.15.
          required:
            - amount
            - grants
            - id
            - locationRef
            - networkRef
            - organizationRef
            - price
            - priceDiscounted
          additionalProperties: false
          description: The package.
      required:
        - package
      additionalProperties: false
    responseError:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
  securitySchemes:
    BasicAuth:
      type: http
      description: >-
        See our [authentication
        documentation](https://www.spacebring.com/docs/api-reference/authentication#basic-authentication)
        for how to authorize your requests
      scheme: basic
    OAuth2:
      type: oauth2
      description: >-
        See our [authentication
        documentation](https://www.spacebring.com/docs/api-reference/authentication#oauth2)
        for how to authorize your requests
      flows:
        authorizationCode:
          authorizationUrl: https://api.spacebring.com/oauth2/authorize
          tokenUrl: https://api.spacebring.com/oauth2/token
          refreshUrl: https://api.spacebring.com/oauth2/token
          scopes:
            benefits.readonly: Read benefits and applications
            benefits: Read and write benefits and applications
            community.readonly: Read community companies and memberships
            community: Read and write community companies and memberships
            events.readonly: Read events and tickets
            events: Read and write events and tickets
            feed.readonly: Read feed posts
            feed: Read and write feed posts
            invoices.readonly: Read contracts, credit notes, discounts and invoices
            invoices: Read and write contract, credit notes, discounts and invoices
            locations.readonly: Read locations
            locations: Read and write locations
            plans.readonly: Read plans
            plans: Read and write plans
            resources.readonly: Read resources and bookings
            resources: Read and write resources and bookings
            subscriptions.readonly: Read subscriptions
            subscriptions: Read and write subscriptions
            shop.readonly: Read products and orders
            shop: Read and write products and orders
            support.readonly: Read support tickets
            support: Read and write support tickets
            transactions.readonly: Read transactions
            transactions: Read and write transactions
            visitors.readonly: Read visitors
            visitors: Read and write visitors

````