> ## 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.

# Updating Metadata

Update the metadata record accompanying a sample. Users may only update the metadata for samples they own, or which are part of shared projects in which they have the relevant metadata editing permissions.


## OpenAPI

````yaml PATCH /api/v1/metadata/{id}
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/metadata/{id}:
    patch:
      summary: PATCH metadata
      operationId: patch_metadata_self
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              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: MetadataPatchSchema
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/metadata'
          description: OK
components:
  schemas:
    metadata:
      properties:
        $uri:
          example: /api/v1/metadata/0d77065796f8d173
          pattern: ^/api/v1/metadata/[a-f0-9]{16}$
          readOnly: true
          title: $Uri
          type: string
        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:
          description: The sample the metadata belongs to.
          properties:
            __DOLLAR_REF__:
              example: /api/v1/samples/a1b2c3d4e5f67890
              format: uri
              pattern: ^/api/v1/samples/[a-f0-9]{16}$
              type: string
          title: samples
          type: object
        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:
          default: false
          description: >-
            Whether the sample has been starred by the user within the One Codex
            web application.
          title: Starred
          type: boolean
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          default: null
          description: >-
            Timestamp for when the object was last updated on the One Codex
            platform, encoded as a [RFC
            3339](https://www.ietf.org/rfc/rfc3339.txt) timestamp.
          title: Updated At
      required:
        - $uri
        - sample
      title: metadata
      type: object
  securitySchemes:
    apiKeyAuth:
      in: header
      name: X-API-Key
      type: apiKey

````

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