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

# Create a signed upload URL for an app

> Creates or updates an app and returns pre-signed upload URLs for each file. Honours an optional `Idempotency-Key` header: a retry with the same key and body returns the same app and version with freshly signed URLs and `Idempotent-Replayed: true`, and never creates a second version. An Idempotency-Key is honoured for 7 days; after that it behaves like a fresh request. A replay whose version was deleted is a 404; a replay whose version already left the queued state is a 409 `idempotency_key_consumed`; a replay that cannot get the version lock within 5 s is a 409 `idempotency_request_in_progress`. Every response produced by a replay, including those 404/409 errors, carries `Idempotent-Replayed: true`. A same-key request still in flight after a 5 s wait is a 409 `idempotency_request_in_progress` (retry after `Retry-After`). If signing fails, nothing is persisted (with or without a key) and the same request, key included, can be retried.



## OpenAPI

````yaml /api-reference/apps-ref.yaml post /apps/create-signed-upload-url
openapi: 3.1.0
info:
  title: Apps Cloud Storage
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /apps/create-signed-upload-url:
    post:
      tags:
        - Apps Cloud Storage
      summary: Create a signed upload URL for an app
      description: >-
        Creates or updates an app and returns pre-signed upload URLs for each
        file. Honours an optional `Idempotency-Key` header: a retry with the
        same key and body returns the same app and version with freshly signed
        URLs and `Idempotent-Replayed: true`, and never creates a second
        version. An Idempotency-Key is honoured for 7 days; after that it
        behaves like a fresh request. A replay whose version was deleted is a
        404; a replay whose version already left the queued state is a 409
        `idempotency_key_consumed`; a replay that cannot get the version lock
        within 5 s is a 409 `idempotency_request_in_progress`. Every response
        produced by a replay, including those 404/409 errors, carries
        `Idempotent-Replayed: true`. A same-key request still in flight after a
        5 s wait is a 409 `idempotency_request_in_progress` (retry after
        `Retry-After`). If signing fails, nothing is persisted (with or without
        a key) and the same request, key included, can be retried.
      operationId: createSignedUploadUrlPublic
      parameters:
        - description: >-
            Idempotency-Key: 1-255 printable ASCII characters. Same key with a
            different request body is a 422 idempotency_key_reused. A retryable
            in-flight duplicate is a 409 with Retry-After and x-should-retry:
            true; a terminal duplicate is a 409 with x-should-retry: false. A
            replay returns the current resource state with Idempotent-Replayed:
            true.
          in: header
          name: idempotency-key
          required: false
          schema:
            description: >-
              Idempotency-Key: 1-255 printable ASCII characters. Same key with a
              different request body is a 422 idempotency_key_reused. A
              retryable in-flight duplicate is a 409 with Retry-After and
              x-should-retry: true; a terminal duplicate is a 409 with
              x-should-retry: false. A replay returns the current resource state
              with Idempotent-Replayed: true.
            example: b3f6a9f0-6f1a-4e9a-9e7a-9c9b6b6a5a3f
            maxLength: 255
            minLength: 1
            pattern: ^[\x21-\x7E]{1,255}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                bundleId:
                  maxLength: 255
                  minLength: 1
                  pattern: ^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_-]*)+$
                  type: string
                country:
                  default: US
                  description: Country code for Search Results
                  example: US
                  type: string
                description:
                  type: string
                developerName:
                  type: string
                displayName:
                  minLength: 1
                  type: string
                files:
                  items:
                    properties:
                      contentType:
                        enum:
                          - application/vnd.android.package-archive
                          - application/octet-stream
                          - application/zip
                        type: string
                      fileName:
                        minLength: 1
                        pattern: ^[^/\\]+\.(apk|xapk|apks|ipa)$/i
                        type: string
                      sha256:
                        pattern: ^[a-f0-9]{64}$/i
                        type: string
                    required:
                      - fileName
                      - contentType
                    type: object
                  minItems: 1
                  type: array
                iconURL:
                  anyOf:
                    - type: string
                    - format: uri
                      type: string
                    - type: string
                platform:
                  default: android
                  enum:
                    - android
                    - ios
                  type: string
                targetSdk:
                  type: number
                versionCode:
                  type: number
                versionName:
                  minLength: 1
                  type: string
              required:
                - bundleId
                - displayName
                - versionCode
                - versionName
                - files
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  appId:
                    description: App ID
                    format: uuid
                    type: string
                  r2UploadUrls:
                    description: Pre-signed upload URLs for uploading app files
                    items:
                      properties:
                        fileName:
                          type: string
                        r2UploadUrl:
                          format: uri
                          type: string
                      required:
                        - fileName
                        - r2UploadUrl
                      type: object
                    type: array
                  versionId:
                    description: App version ID
                    format: uuid
                    type: string
                required:
                  - versionId
                  - appId
                  - r2UploadUrls
                type: object
          description: Signed upload URL created successfully
          headers:
            Idempotent-Replayed:
              description: >-
                Present and `true` when this response replays an earlier request
                with the same Idempotency-Key.
              schema:
                enum:
                  - 'true'
                type: string
        '400':
          content:
            application/json:
              schema:
                anyOf:
                  - properties:
                      code:
                        enum:
                          - invalid_idempotency_key
                        type: string
                      message:
                        type: string
                      retryAfterSeconds:
                        type: number
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                  - $ref: '#/components/schemas/AppsApiErrorResponse'
                  - $ref: '#/components/schemas/ApiErrorEnvelope'
          description: >-
            Bad Request: malformed Idempotency-Key (`invalid_idempotency_key`),
            request validation failure, or generic bad request
        '401':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ApiErrorEnvelope'
                  - $ref: '#/components/schemas/AppsLegacyUnauthorizedError'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppsApiErrorResponse'
          description: Not Found
          headers:
            Idempotent-Replayed:
              description: >-
                Present and `true` when this 404 replays an Idempotency-Key
                whose resource has since been deleted.
              schema:
                enum:
                  - 'true'
                type: string
        '409':
          content:
            application/json:
              schema:
                anyOf:
                  - properties:
                      code:
                        enum:
                          - idempotency_request_in_progress
                        type: string
                      message:
                        type: string
                      retryAfterSeconds:
                        type: number
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                  - properties:
                      code:
                        enum:
                          - idempotency_key_consumed
                        type: string
                      message:
                        type: string
                      retryAfterSeconds:
                        type: number
                      traceId:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                  - $ref: '#/components/schemas/AppsApiErrorResponse'
          description: >-
            Conflict: `idempotency_request_in_progress` (retry),
            `idempotency_key_consumed` (do not retry) or a generic conflict
          headers:
            Idempotent-Replayed:
              description: >-
                Present and `true` when the 409 comes from a replay
                (idempotency_key_consumed, or a replay waiting on the version
                lock).
              schema:
                enum:
                  - 'true'
                type: string
            Retry-After:
              description: >-
                Seconds to wait before retrying; set for
                idempotency_request_in_progress.
              example: 1
              schema:
                type: integer
            x-should-retry:
              description: >-
                `true` for idempotency_request_in_progress, `false` for
                idempotency_key_consumed.
              schema:
                enum:
                  - 'true'
                  - 'false'
                type: string
        '422':
          content:
            application/json:
              schema:
                properties:
                  code:
                    enum:
                      - idempotency_key_reused
                    type: string
                  message:
                    type: string
                  retryAfterSeconds:
                    type: number
                  traceId:
                    type: string
                required:
                  - code
                  - message
                type: object
          description: >-
            Idempotency-Key was reused with a different request body
            (`idempotency_key_reused`)
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppsInternalServerError'
          description: Internal Server Error
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Mobilerun from '@mobilerun/sdk';

            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.apps.createSignedUploadURL({
              bundleId: 'NX0.JB-_-.m-u--_-p.Z1-u_2I.D--_T-_.dzZ-.Wx.L_a8--_.w_D_',
              displayName: 'x',
              files: [
                { contentType: 'application/vnd.android.package-archive', fileName: 'J!Q0Ok0bzJb7.apk/i' },
              ],
              versionCode: 0,
              versionName: 'x',
            });

            console.log(response.appId);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            response = client.apps.create_signed_upload_url(
                bundle_id="NX0.JB-_-.m-u--_-p.Z1-u_2I.D--_T-_.dzZ-.Wx.L_a8--_.w_D_",
                display_name="x",
                files=[{
                    "content_type": "application/vnd.android.package-archive",
                    "file_name": "J!Q0Ok0bzJb7.apk/i",
                }],
                version_code=0,
                version_name="x",
            )
            print(response.app_id)
components:
  schemas:
    AppsApiErrorResponse:
      properties:
        code:
          $ref: '#/components/schemas/AppsErrorCode'
        message:
          type: string
      required:
        - code
        - message
      type: object
    ApiErrorEnvelope:
      properties:
        code:
          type: string
        details: {}
        message:
          type: string
        retryAfterSeconds:
          type: number
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    AppsLegacyUnauthorizedError:
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object
    AppsInternalServerError:
      properties:
        code:
          enum:
            - internal_error
          type: string
        message:
          type: string
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    AppsErrorCode:
      enum:
        - bad_request
        - not_found
        - conflict
        - rate_limited
        - temporarily_unavailable
        - internal_error
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

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