> ## 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 delivery

> Record a delivery that arrived at a location for one of its customers, a person or a company. The delivery starts out <code>pending</code>, and the customer is notified about it and reminded to pick it up. To attach a photo, create a media upload first and pass its key as <code>media[0].key</code>. With bearer token authentication, the user must be an administrator who can manage deliveries in the location. <h3>OAuth</h3>Required scopes: <code>deliveries</code>



## OpenAPI

````yaml /assets/openapi.json post /deliveries/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:
  /deliveries/v1:
    post:
      tags:
        - Deliveries
      summary: Create a delivery
      description: >-
        Record a delivery that arrived at a location for one of its customers, a
        person or a company. The delivery starts out <code>pending</code>, and
        the customer is notified about it and reminded to pick it up. To attach
        a photo, create a media upload first and pass its key as
        <code>media[0].key</code>. With bearer token authentication, the user
        must be an administrator who can manage deliveries in the location.
        <h3>OAuth</h3>Required scopes: <code>deliveries</code>
      operationId: createDelivery
      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/createDelivery'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getDelivery'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseError'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseError'
      security:
        - BasicAuth: []
        - OAuth2:
            - deliveries
components:
  requestBodies:
    createDelivery:
      content:
        application/json:
          schema:
            type: object
            properties:
              delivery:
                type: object
                properties:
                  comment:
                    description: >-
                      Comment about the delivery for the customer, such as the
                      carrier or how to handle the item.
                    nullable: true
                    type: string
                    maxLength: 1000
                  locationRef:
                    type: string
                    format: uuid
                    description: ID of the location where the delivery is kept.
                  media:
                    description: >-
                      Photo of the delivery to attach. The url is generated
                      server-side.
                    maxItems: 1
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          description: >-
                            Storage key of the media file, as returned by the
                            media upload endpoint.
                      required:
                        - key
                  customer:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: >-
                          ID of the customer the delivery is for. The customer
                          must belong to the delivery's location.
                      type:
                        type: string
                        enum:
                          - company
                          - user
                        description: Whether the customer is a person or a whole company.
                    required:
                      - id
                      - type
                    description: >-
                      The customer the delivery is for: a person's customer ID
                      with type user, or a company's with type company.
                required:
                  - locationRef
                  - customer
            required:
              - delivery
      required: true
  schemas:
    getDelivery:
      type: object
      properties:
        delivery:
          type: object
          additionalProperties: false
          description: The delivery.
          properties:
            comment:
              nullable: true
              description: >-
                Comment about the delivery for the customer, such as the carrier
                or how to handle the item.
              type: string
            createDate:
              type: string
              format: date-time
              description: ISO timestamp of when the delivery was added.
            id:
              type: string
              format: uuid
              description: Unique identifier of the delivery.
            locationRef:
              type: string
              format: uuid
              description: ID of the location where the delivery is kept.
            media:
              type: array
              items:
                type: object
                properties:
                  key:
                    type: string
                    description: Storage key of the media file.
                  url:
                    type: string
                    description: Public URL of the media file.
                required:
                  - key
                  - url
                additionalProperties: false
              description: Photo of the delivery, or an empty list when it has none.
            pickupDate:
              nullable: true
              description: ISO timestamp of when the delivery was picked up.
              type: string
              format: date-time
            customer:
              type: object
              properties:
                company:
                  description: >-
                    The company the delivery is for, read from the customers
                    service so the name is current.
                  type: object
                  properties:
                    id:
                      type: string
                      format: uuid
                      description: Unique identifier of the company.
                    logo:
                      description: Company logo, when the company has one.
                      type: object
                      properties:
                        key:
                          type: string
                          description: Storage key of the logo.
                        url:
                          type: string
                          description: Public URL of the logo.
                      required:
                        - key
                        - url
                      additionalProperties: false
                    publicLogoUrl:
                      description: >-
                        Logo found from the company website, to show when the
                        company has no logo of its own.
                      type: string
                    title:
                      type: string
                      description: Name of the company.
                  required:
                    - id
                    - title
                  additionalProperties: false
                id:
                  type: string
                  format: uuid
                  description: ID of the customer the delivery is for.
                type:
                  type: string
                  enum:
                    - company
                    - user
                  description: Whether the delivery is for a person or for a whole company.
                user:
                  description: >-
                    The person the delivery is for, read from the users service
                    so the details are current.
                  type: object
                  properties:
                    deleteDate:
                      description: ISO timestamp of when the user account was deleted.
                      type: string
                      format: date-time
                    email:
                      description: Email address of the user.
                      nullable: true
                      type: string
                    id:
                      type: string
                      format: uuid
                      description: Unique identifier of the user.
                    name:
                      description: First name of the user.
                      nullable: true
                      type: string
                    phoneNumber:
                      description: Phone number of the user.
                      nullable: true
                      type: string
                    photoUrl:
                      description: User profile photo URL.
                      nullable: true
                      type: string
                    surname:
                      description: Surname of the user.
                      nullable: true
                      type: string
                  required:
                    - id
                  additionalProperties: false
              required:
                - id
                - type
              additionalProperties: false
              description: The customer the delivery is for.
            status:
              type: string
              enum:
                - pending
                - pickedUp
              description: >-
                Whether the delivery is still kept at the location or was picked
                up.
          required:
            - comment
            - createDate
            - id
            - locationRef
            - media
            - pickupDate
            - customer
            - status
      required:
        - delivery
      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/developer/api/authentication#basic-authentication)
        for how to authorize your requests
      scheme: basic
    OAuth2:
      type: oauth2
      description: >-
        See our [authentication
        documentation](https://www.spacebring.com/docs/developer/api/authentication#oauth2)
        for how to authorize your requests
      flows:
        authorizationCode:
          authorizationUrl: https://oauth2.spacebring.com/api/oauth2/authorize
          tokenUrl: https://oauth2.spacebring.com/api/oauth2/token
          refreshUrl: https://oauth2.spacebring.com/api/oauth2/token
          scopes:
            benefits.readonly: Read benefits and applications
            benefits: Read and write benefits and applications
            campaigns.readonly: Read campaigns
            campaigns: Read and write campaigns
            checkIns.readonly: Read check-ins
            checkIns: Read and write check-ins
            community.readonly: Read community companies and memberships
            community: Read and write community companies and memberships
            deliveries.readonly: Read deliveries
            deliveries: Read and write deliveries
            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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.