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

# Pre-Uploading Samples

For situations where you'd like to create Samples on the One Codex Platform, but your NGS data is not yet available, we support a "pre-upload" workflow. Simply POST to the `/preupload` route to receive a unique sample ID. That sample ID may be then passed when uploading your data (see [Starting an Upload](/api-reference/samples-resource-upload-file)) to upload data for the pre-uploaded sample instead of creating a new sample.

Samples created via the `/preupload` route will have a visibility property with a value awaiting data. These samples and their metadata will be `private`, though they may be shared with other accounts if associated with a project at creation time (see [Sharing & Projects](https://docs.onecodex.com/en/articles/3764345-sharing-projects) for more details on sharing data via projects).


## OpenAPI

````yaml POST /api/v1/samples/preupload
openapi: 3.1.0
info:
  description: >-
    The One Codex API (v1) -- programmatic access to One Codex's suite of
    microbial genomics data storage, analysis, and query tools.
  title: One Codex API (v1)
  version: v1
servers:
  - url: https://app.onecodex.com
security:
  - apiKeyAuth: []
paths:
  /api/v1/samples/preupload:
    post:
      summary: POST samples instances_preupload
      operationId: post_samples_instances_preupload
      requestBody:
        content:
          application/json:
            schema:
              properties:
                metadata:
                  anyOf:
                    - properties:
                        custom:
                          anyOf:
                            - additionalProperties: true
                              type: object
                            - type: 'null'
                          description: >-
                            Arbitrary metadata is supported as part of a custom
                            object. custom has two constraints: (1) it must have
                            a depth of one (i.e., no nested records); and (2)
                            only strings, numbers, boolean, and null values are
                            supported as values. Example: `{"lab_tech": "Linus
                            Pauling", "amplicon_scheme": "V3-V4"}`
                          title: Custom
                        date_collected:
                          anyOf:
                            - format: date-time
                              type: string
                            - type: 'null'
                          default: null
                          description: Timestamp for when the sample was collected.
                          title: Date Collected
                        date_sequenced:
                          anyOf:
                            - format: date-time
                              type: string
                            - type: 'null'
                          default: null
                          description: Timestamp for when the sample was sequenced.
                          title: Date Sequenced
                        description:
                          anyOf:
                            - type: string
                            - type: 'null'
                          default: null
                          title: Description
                        external_sample_id:
                          anyOf:
                            - type: string
                            - type: 'null'
                          default: null
                          description: >-
                            An arbitrary external sample ID, e.g., an ID in a
                            LIMS. Up to 60 characters.
                          example: LIMS-2024-00123
                          title: External Sample Id
                        library_type:
                          anyOf:
                            - description: >-
                                Allowed types of SampleMetadata.library_type.
                                Also used to populate

                                form dropdown in the front-end
                              enum:
                                - WGS
                                - Targeted/16S
                                - Other
                              title: SequencingLibraryType
                              type: string
                            - type: 'null'
                          default: null
                          description: An enum with the sample library type.
                        location_lat:
                          anyOf:
                            - maximum: 90
                              minimum: -90
                              type: number
                            - type: 'null'
                          default: null
                          description: >-
                            The latitude `(-90.0-90.0)` of the sample location.
                            By convention, we recommend using this for the
                            location in which the physical specimen was
                            collected.
                          title: Location Lat
                        location_lon:
                          anyOf:
                            - maximum: 180
                              minimum: -180
                              type: number
                            - type: 'null'
                          default: null
                          description: >-
                            The longitude `(-180.0-180.0)` of the sample
                            location.
                          title: Location Lon
                        location_string:
                          anyOf:
                            - maxLength: 255
                              type: string
                            - type: 'null'
                          default: null
                          title: Location String
                        name:
                          anyOf:
                            - maxLength: 255
                              type: string
                            - type: 'null'
                          default: null
                          title: Name
                        platform:
                          anyOf:
                            - description: Allowed values of SampleMetadata.platform.
                              enum:
                                - 454 sequencing
                                - 454 GS FLX
                                - 454 GS FLX Titanium
                                - Illumina
                                - Illumina Genome Analyzer II
                                - Illumina HiSeq
                                - Illumina HiSeq 1500
                                - Illumina HiSeq 2000
                                - Illumina HiSeq 2500
                                - Illumina HiSeq 3000
                                - Illumina HiSeq 4000
                                - Illumina HiSeq X
                                - Illumina iSeq 100
                                - Illumina MiniSeq
                                - Illumina MiSeq
                                - Illumina NextSeq
                                - Illumina NextSeq 500
                                - Illumina NextSeq 550
                                - Illumina NovaSeq
                                - Illumina NovaSeq 5000
                                - Illumina NovaSeq 6000
                                - BGISEQ
                                - BGISEQ 50
                                - Element
                                - Element AVITI
                                - Ion
                                - Ion S5
                                - Ion S5 XL
                                - Ion PGM
                                - Ion Proton
                                - Ion Torrent
                                - Oxford Nanopore
                                - Oxford Nanopore GridION X5
                                - Oxford Nanopore MinION
                                - Oxford Nanopore PromethION
                                - PacBio
                                - PacBio RS II
                                - PacBio Sequel
                                - PacBio Sequel II System
                                - PacBio Revio
                                - PacBio Onso
                                - SOLiD
                                - Solexa Genome Analyzer
                                - Sanger
                                - Other
                              title: SequencingPlatform
                              type: string
                            - type: 'null'
                          default: null
                          description: An enum with the name of the sequencing platform.
                        sample_type:
                          anyOf:
                            - description: >-
                                Allowed values for SampleMetadata.sample_type. 
                                Used to populate values in

                                the front-end dropdown
                              enum:
                                - Isolate
                                - Metagenomic
                                - Other
                              title: SequencingSampleType
                              type: string
                            - type: 'null'
                          default: null
                          description: An enum with the sample type.
                        starred:
                          anyOf:
                            - type: boolean
                            - type: 'null'
                          default: false
                          description: >-
                            Whether the sample has been starred by the user
                            within the One Codex web application.
                          title: Starred
                      title: InlineMetadata
                      type: object
                    - type: 'null'
                  default: null
                project:
                  anyOf:
                    - properties:
                        __DOLLAR_REF__:
                          example: /api/v1/projects/a1b2c3d4e5f67890
                          format: uri
                          pattern: ^/api/v1/projects/[a-f0-9]{16}$
                          type: string
                      type: object
                    - type: 'null'
                  default: null
                  description: An optional project.
                tags:
                  default: []
                  items:
                    properties:
                      name:
                        description: >-
                          The tag label or name. Name must be 30 characters or
                          fewer.
                        maxLength: 30
                        title: Name
                        type: string
                    required:
                      - name
                    title: InlineTag
                    type: object
                  title: Tags
                  type: array
              title: SampleInitPreuploadSchema
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  sample_id:
                    description: The sample ID. Use to confirm the upload.
                    title: Sample Id
                    type: string
                required:
                  - sample_id
                title: SampleInitPreuploadResponse
                type: object
          description: OK
components:
  securitySchemes:
    apiKeyAuth:
      in: header
      name: X-API-Key
      type: apiKey

````