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

# Declare Provider Version

> Declare a provider version from what its wheel claims about itself.

The wheel's ``pragma.provider`` entry point names the provider in the
caller's organization. The version is recorded as ``awaiting_wheel``;
upload its wheel to ``PUT /providers/publish/{operation_id}/wheel``
with the returned ``operation_id``, then poll the version until it is
``published`` or ``failed``, where ``error_message`` says why.

Returns:
    The version with its ``operation_id``, ``awaiting_wheel`` until its
    wheel is uploaded.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /providers/publish
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /providers/publish:
    post:
      tags:
        - providers
      summary: Declare Provider Version
      description: |-
        Declare a provider version from what its wheel claims about itself.

        The wheel's ``pragma.provider`` entry point names the provider in the
        caller's organization. The version is recorded as ``awaiting_wheel``;
        upload its wheel to ``PUT /providers/publish/{operation_id}/wheel``
        with the returned ``operation_id``, then poll the version until it is
        ``published`` or ``failed``, where ``error_message`` says why.

        Returns:
            The version with its ``operation_id``, ``awaiting_wheel`` until its
            wheel is uploaded.
      operationId: providers-declare_provider_version
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProviderVersionDeclaration'
        required: true
      responses:
        '200':
          description: >-
            Admission of the same declaration has not finished; its version is
            returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeclaredProviderVersion'
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeclaredProviderVersion'
        '400':
          description: >-
            The declaration does not describe a valid wheel, or the provider
            name it declares is not valid.
        '409':
          description: >-
            The version is already published, the distribution name belongs to
            another provider, its admitted wheel is being published, or the
            organization's deletion started during the publish
            (`organization_deleting`).
        '410':
          description: The organization is being deleted (`organization_deactivating`).
        '413':
          description: >-
            The wheel expands to more than 256 MiB. Reduce its size and publish
            it again.
        '422':
          description: >-
            The version is not MAJOR.MINOR.PATCH, the wheel does not declare
            exactly one provider, its Requires-Python is invalid or longer than
            255 characters, its Summary or Keywords exceed the catalog limits,
            an embedded provider it declares is not a Pragmatiks provider or is
            the provider itself, or it requires a Pragmatiks provider that is
            neither declared under pragma.embeds nor embedded by a declared
            provider. A requirement whose environment marker names `extra` is
            not checked here; admission refuses a provider it brings in. Also
            answered when a declared field exceeds its limit: the wheel filename
            past 255 characters, the `.dist-info` directory past 255 characters,
            `METADATA` or `entry_points.txt` past 4 MiB, or the changelog past
            65536 characters.
components:
  schemas:
    ProviderVersionDeclaration:
      properties:
        wheel_filename:
          type: string
          maxLength: 255
          minLength: 1
          title: Wheel Filename
        wheel_sha256:
          type: string
          pattern: ^[0-9a-f]{64}$
          title: Wheel Sha256
        wheel_size:
          type: integer
          exclusiveMinimum: 0
          title: Wheel Size
        dist_info_directory:
          type: string
          maxLength: 255
          minLength: 1
          title: Dist Info Directory
        metadata:
          $ref: '#/components/schemas/DistInfoFileContents'
          description: >-
            Base64 text of the wheel's METADATA file, at most 4 MiB once
            decoded.
        entry_points:
          anyOf:
            - $ref: '#/components/schemas/DistInfoFileContents'
            - type: 'null'
          description: >-
            Base64 text of the wheel's entry_points.txt file, at most 4 MiB once
            decoded.
        changelog:
          anyOf:
            - type: string
              maxLength: 65536
            - type: 'null'
          title: Changelog
      type: object
      required:
        - wheel_filename
        - wheel_sha256
        - wheel_size
        - dist_info_directory
        - metadata
      title: ProviderVersionDeclaration
      description: >-
        What a provider wheel claims about itself, declared before it is
        uploaded.


        ``metadata`` and ``entry_points`` arrive as base64 text and hold the

        decoded bytes. The wheel uploaded afterwards must match the

        declaration.


        Attributes:
            wheel_filename: Filename of the built wheel.
            wheel_sha256: Lowercase hex SHA-256 digest of the wheel file.
            wheel_size: Size of the wheel file in bytes.
            dist_info_directory: Name of the wheel's ``.dist-info`` directory,
                such as ``postgresql-1.0.0.dist-info``.
            metadata: Contents of the wheel's ``METADATA`` file.
            entry_points: Contents of the wheel's ``entry_points.txt``, or
                ``None`` when the wheel has none.
            changelog: Release notes for the version, or ``None``.
    DeclaredProviderVersion:
      properties:
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        prefix:
          type: string
          title: Prefix
        name:
          type: string
          title: Name
        version:
          type: string
          title: Version
        wheel_filename:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Wheel Filename
        wheel_sha256:
          anyOf:
            - type: string
              pattern: ^[0-9a-f]{64}$
            - type: 'null'
          title: Wheel Sha256
        distribution_name:
          type: string
          maxLength: 200
          minLength: 1
          title: Distribution Name
        package:
          anyOf:
            - type: string
            - type: 'null'
          title: Package
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
        keywords:
          items:
            type: string
          type: array
          title: Keywords
        schemas:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Schemas
        python_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Python Version
        sdk_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Sdk Version
        protocol_versions:
          items:
            type: integer
          type: array
          title: Protocol Versions
        embedded_providers:
          additionalProperties:
            type: string
          type: object
          title: Embedded Providers
        operation_id:
          type: string
          minLength: 1
          title: Operation Id
        operation_deadline_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Operation Deadline At
        changelog:
          anyOf:
            - type: string
            - type: 'null'
          title: Changelog
        status:
          $ref: '#/components/schemas/VersionStatus'
          default: awaiting_wheel
        published_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Published At
        failure_category:
          anyOf:
            - $ref: '#/components/schemas/AdmissionFailureCategory'
            - type: 'null'
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
        canonical:
          type: string
          title: Canonical
          description: >-
            Slash-joined ``prefix/name`` canonical string of the owning
            provider.


            Returns:
                Display form of the provider identity this version belongs to.
          readOnly: true
      type: object
      required:
        - prefix
        - name
        - version
        - distribution_name
        - operation_id
        - canonical
      title: DeclaredProviderVersion
      description: |-
        A provider version as its publish declaration returns it.

        Only the declaration response carries ``operation_id``; every other
        response leaves it out.

        Attributes:
            operation_id: Publish operation the version's wheel is uploaded to,
                at ``PUT /providers/publish/{operation_id}/wheel``.
    DistInfoFileContents:
      type: string
      maxLength: 5592408
      format: base64
      contentMediaType: application/octet-stream
    VersionStatus:
      type: string
      enum:
        - awaiting_wheel
        - staged
        - queued
        - admitting
        - promoting
        - published
        - failed
      title: VersionStatus
      description: |-
        Publish lifecycle status for a provider version.

        A declared version is ``awaiting_wheel`` until its wheel is uploaded,
        then ``staged``, ``queued`` for the organization's provider host,
        ``admitting`` while the host admits it, and ``promoting`` while the
        admitted wheel is copied to the registry. It ends ``published``
        (terminal) or ``failed``; a failed version may be published again
        under the same version number.
    AdmissionFailureCategory:
      type: string
      enum:
        - wheel_refused
        - wheel_lost
        - digest_mismatch
        - python_unavailable
        - dependency_resolution_failed
        - undeclared_embedded_provider
        - unregistered_embedded_provider
        - embedded_provider_not_depended_on
        - unsupported_protocol
        - import_failed
        - missing_observe
        - stored_wheel_conflict
        - deadline_exceeded
        - platform_error
        - organization_deleted
      title: AdmissionFailureCategory
      description: Why a provider version failed admission.

````

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