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

# Initiate Attachment Upload

> Initiate a target-scoped attachment upload (see module docstring §gate).



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/hub/{hub_id}/attachment-uploads
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/hub/{hub_id}/attachment-uploads:
    post:
      tags:
        - community-attachment-upload
      summary: Initiate Attachment Upload
      description: Initiate a target-scoped attachment upload (see module docstring §gate).
      operationId: >-
        community_attachment_upload.post_community_attachment_upload_post_hub_by_hub_id_attachment_uploads
      parameters:
        - in: path
          name: hub_id
          required: true
          schema:
            title: Hub Id
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/AttachmentUploadInitiateEnvelope'
        required: true
      responses:
        '201':
          content:
            application/vnd.api+json:
              schema:
                $ref: >-
                  #/components/schemas/JsonApiResponse_AttachmentUploadAttributes_
          description: Successful Response
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    AttachmentUploadInitiateEnvelope:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/AttachmentUploadInitiateData'
      required:
        - data
      title: AttachmentUploadInitiateEnvelope
      type: object
    JsonApiResponse_AttachmentUploadAttributes_:
      properties:
        data:
          $ref: '#/components/schemas/JsonApiResource_AttachmentUploadAttributes_'
        included:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Included
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - data
      title: JsonApiResponse[AttachmentUploadAttributes]
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    AttachmentUploadInitiateData:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/AttachmentUploadInitiateAttributes'
        type:
          const: attachment_upload_requests
          title: Type
          type: string
      required:
        - type
        - attributes
      title: AttachmentUploadInitiateData
      type: object
    JsonApiResource_AttachmentUploadAttributes_:
      properties:
        attributes:
          $ref: '#/components/schemas/AttachmentUploadAttributes'
        id:
          title: Id
          type: string
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        relationships:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Relationships
        type:
          title: Type
          type: string
      required:
        - id
        - type
        - attributes
      title: JsonApiResource[AttachmentUploadAttributes]
      type: object
    JsonApiLinks:
      properties:
        self:
          anyOf:
            - type: string
            - type: 'null'
          title: Self
      title: JsonApiLinks
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    AttachmentUploadInitiateAttributes:
      additionalProperties: false
      description: Attributes for POST /attachment-uploads (initiate).
      properties:
        attachment_context:
          title: Attachment Context
          type: string
        context_target_id:
          title: Context Target Id
          type: string
        context_target_type:
          title: Context Target Type
          type: string
        filename:
          maxLength: 255
          minLength: 1
          title: Filename
          type: string
        mime_type:
          title: Mime Type
          type: string
        parent_comment_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Comment Id
        size_bytes:
          exclusiveMinimum: 0
          maximum: 524288000
          title: Size Bytes
          type: integer
      required:
        - attachment_context
        - mime_type
        - size_bytes
        - filename
        - context_target_type
        - context_target_id
      title: AttachmentUploadInitiateAttributes
      type: object
    AttachmentUploadAttributes:
      additionalProperties: false
      description: Response attributes for an initiated attachment upload.
      properties:
        file_id:
          title: File Id
          type: string
        media_id:
          title: Media Id
          type: string
        required_headers:
          additionalProperties:
            type: string
          title: Required Headers
          type: object
        status_upload:
          title: Status Upload
          type: string
      required:
        - file_id
        - media_id
        - status_upload
        - required_headers
      title: AttachmentUploadAttributes
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````