> ## 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.0.0
info:
  title: One Codex API (v1)
  description: >-
    The One Codex API (v1) -- programmatic access to One Codex's suite of
    microbial genomics data storage, analysis, and query tools.
  version: v1
servers:
  - url: https://app.onecodex.com
security:
  - apiKeyAuth: []
paths:
  /api/v1/metadata/{id}:
    patch:
      summary: PATCH metadata update
      operationId: patch_metadata_update
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                custom:
                  type: object
                  default: {}
                  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"}`
                date_collected:
                  type: string
                  nullable: true
                  format: date-time
                  description: Timestamp for when the sample was collected.
                date_sequenced:
                  type: string
                  nullable: true
                  format: date-time
                  description: Timestamp for when the sample was sequenced.
                description:
                  type: string
                  nullable: true
                external_sample_id:
                  type: string
                  nullable: true
                  maxLength: 60
                  description: >-
                    An arbitrary external sample ID, e.g., an ID in a LIMS. Up
                    to 60 characters.
                library_type:
                  type: string
                  nullable: true
                  enum:
                    - WGS
                    - Targeted/16S
                    - Other
                    - null
                  description: An enum with the sample library type.
                location_lat:
                  type: number
                  nullable: true
                  minimum: -90
                  maximum: 90
                  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.
                location_lon:
                  type: number
                  nullable: true
                  minimum: -180
                  maximum: 180
                  description: The longitude `(-180.0-180.0)` of the sample location.
                location_string:
                  type: string
                  nullable: true
                  maxLength: 255
                name:
                  type: string
                  nullable: true
                  maxLength: 255
                platform:
                  type: string
                  nullable: true
                  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
                    - null
                  description: An enum with the name of the sequencing platform.
                sample:
                  type: object
                  description: The sample the metadata belongs to.
                  anyOf:
                    - type: object
                      properties:
                        $ref: 31067cd2-e067-4b19-a9d4-b69fae0b5e19
                    - type: string
                      nullable: true
                      maxLength: 16
                sample_type:
                  type: string
                  nullable: true
                  enum:
                    - Isolate
                    - Metagenomic
                    - Other
                    - null
                  description: An enum with the sample type.
                starred:
                  type: boolean
                  default: false
                  description: >-
                    Whether the sample has been starred by the user within the
                    One Codex web application.
        required: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/metadata'
components:
  schemas:
    metadata:
      type: object
      properties:
        $uri:
          type: string
          pattern: ^/api/v1/metadata\/[^/]+$
          example: /api/v1/metadata/a1b2c3d4e5f67890
        custom:
          type: object
          default: {}
          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"}`
        date_collected:
          type: string
          nullable: true
          format: date-time
          description: Timestamp for when the sample was collected.
        date_sequenced:
          type: string
          nullable: true
          format: date-time
          description: Timestamp for when the sample was sequenced.
        description:
          type: string
          nullable: true
        external_sample_id:
          type: string
          nullable: true
          maxLength: 60
          description: >-
            An arbitrary external sample ID, e.g., an ID in a LIMS. Up to 60
            characters.
          format: uuid
          example: a1b2c3d4e5f67890
        library_type:
          type: string
          nullable: true
          enum:
            - WGS
            - Targeted/16S
            - Other
            - null
          description: An enum with the sample library type.
        location_lat:
          type: number
          nullable: true
          minimum: -90
          maximum: 90
          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.
        location_lon:
          type: number
          nullable: true
          minimum: -180
          maximum: 180
          description: The longitude `(-180.0-180.0)` of the sample location.
        location_string:
          type: string
          nullable: true
          maxLength: 255
        name:
          type: string
          nullable: true
          maxLength: 255
        platform:
          type: string
          nullable: true
          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
            - null
          description: An enum with the name of the sequencing platform.
        sample:
          type: object
          description: The sample the metadata belongs to.
          properties:
            $ref: f875e7c5-15e3-48f7-a1f9-81aacfade720
        sample_type:
          type: string
          nullable: true
          enum:
            - Isolate
            - Metagenomic
            - Other
            - null
          description: An enum with the sample type.
        starred:
          type: boolean
          default: false
          description: >-
            Whether the sample has been starred by the user within the One Codex
            web application.
        updated_at:
          type: string
          format: date-time
          description: >-
            Timestamp for when the object was last updated, encoded as a [RFC
            3339](https://www.ietf.org/rfc/rfc3339.txt) timestamp.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````