> ## 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 an attachment upload

> Create an upload for a file to attach to a guide, of any type up to 50 MB. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key in <code>attachments[].key</code> when creating or updating a guide within an hour; a file that is not attached by then is discarded. The file is served as a download under the declared name. <h3>OAuth</h3>Required scopes: <code>support</code>



## OpenAPI

````yaml /assets/openapi.json post /guides/v1/attachments
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:
  /guides/v1/attachments:
    post:
      tags:
        - Guides
      summary: Create an attachment upload
      description: >-
        Create an upload for a file to attach to a guide, of any type up to 50
        MB. The response carries a presigned URL: send the raw file bytes with a
        PUT request within a minute, using exactly the headers returned. Once
        the file is stored, pass the returned key in
        <code>attachments[].key</code> when creating or updating a guide within
        an hour; a file that is not attached by then is discarded. The file is
        served as a download under the declared name. <h3>OAuth</h3>Required
        scopes: <code>support</code>
      operationId: createGuideAttachment
      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/createGuideAttachment'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createGuideAttachment'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseError'
      security:
        - BasicAuth: []
        - OAuth2:
            - support
components:
  requestBodies:
    createGuideAttachment:
      content:
        application/json:
          schema:
            type: object
            properties:
              attachment:
                type: object
                properties:
                  mimeType:
                    type: string
                    description: MIME type of the file to upload.
                  name:
                    description: >-
                      File name shown with the guide and used when the file is
                      downloaded. Defaults to the storage key.
                    type: string
                    minLength: 1
                    maxLength: 255
                  size:
                    type: integer
                    minimum: 0
                    exclusiveMinimum: true
                    maximum: 52428800
                    description: >-
                      Size of the file in bytes. The upload is rejected when the
                      body length differs.
                required:
                  - mimeType
                  - size
                description: File to upload.
            required:
              - attachment
      required: true
  schemas:
    createGuideAttachment:
      type: object
      properties:
        attachment:
          type: object
          properties:
            key:
              type: string
              description: >-
                Storage key of the file. Pass it in attachments[].key when
                creating or updating a guide.
            mimeType:
              type: string
              description: MIME type of the file.
            name:
              type: string
              description: File name shown with the guide.
            size:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Size of the file in bytes.
            status:
              type: string
              enum:
                - pending
              description: >-
                Upload status. pending: the file has not been received yet;
                attach it once the PUT request succeeds.
            upload:
              type: object
              properties:
                expirationDate:
                  type: string
                  format: date-time
                  description: ISO timestamp after which the upload URL is rejected.
                headers:
                  type: object
                  properties:
                    Content-Disposition:
                      type: string
                      description: Makes browsers download the file rather than open it.
                    Content-Length:
                      type: string
                      description: >-
                        Must equal the size declared when the upload was
                        created.
                    Content-Type:
                      type: string
                      description: >-
                        Must equal the mimeType declared when the upload was
                        created.
                  required:
                    - Content-Disposition
                    - Content-Length
                    - Content-Type
                  additionalProperties: false
                  description: >-
                    Headers the PUT request must send exactly as given; the
                    signature covers them.
                method:
                  type: string
                  enum:
                    - PUT
                  description: HTTP method of the upload request.
                url:
                  type: string
                  description: Presigned URL to send the raw file bytes to.
              required:
                - expirationDate
                - headers
                - method
                - url
              additionalProperties: false
              description: >-
                How to upload the file. Send the raw bytes as the request body,
                not a multipart form.
            url:
              type: string
              description: Public URL the file is served from once uploaded.
          required:
            - key
            - mimeType
            - name
            - size
            - status
            - upload
            - url
          additionalProperties: false
          description: The created attachment upload.
      required:
        - attachment
      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
            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
            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.