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

# Retrieve Classification Results

Return the results of a classification as JSON. The returned JSON has the following top-level structure:

| Property                              | Description                                                                                                                                                                                                                                |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **n\_reads** *integer*                | The total number of reads (or FASTA contigs/records) in sample.                                                                                                                                                                            |
| **host\_tax\_ids** *array of strings* | An array of the taxonomy ID for all known hosts in the sample. Filtering out the host\_tax\_ids and any non-unique mappings (e.g., those to "root" and "cellular organisms") can be used to produce a table of exclusively microbial taxa. |
| **table** *object*                    | The results in a tabular format. Results will typically be sorted by readcount\_w\_children (descending). See below for more details.                                                                                                      |

The `table` object has the results for *all taxa* in the sample and the following fields:

| Property                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **tax\_id** *string*                 | A taxonomy ID. Currently, these are [NCBI taxonomy IDs](https:///ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi) and strictly versioned as part of the job. `tax_id` should be handled as a string in part to support future compatibility with non-NCBI taxonomies.                                                                                                                                                                                                                                                              |
| **name** *string*                    | The name of the taxon. This is provided strictly for convenience and names for a given taxa are not guaranteed to remain identical over time. Use `tax_id` when comparing equality across different taxa.                                                                                                                                                                                                                                                                                                                       |
| **rank** *string*                    | The taxonomic rank. This is also provided for convenience and guaranteed to be consistent *for a given job* but may change over time as, e.g., previously poorly characterized organisms are better characterized and taxonomically re-labeled.                                                                                                                                                                                                                                                                                 |
| **parent\_tax\_id** *string*         | The immediate parent of the taxon. Guaranteed to be consistent for all classifications using a given job.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **readcount** *integer*              | The number of reads (or records or contigs for FASTA files) classified at the given taxon.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **readcount\_w\_children** *integer* | The number of reads classified at the given taxon and all of its children. E.g., if 50 reads map to *Enterobacteriaceae* in a sample and 50 reads map to *E. coli*, `readcount` would be 50 for *Enterobacteriaceae* and `readcount_w_children` would be 100.                                                                                                                                                                                                                                                                   |
| **abundance** *number*               | An estimated *relative microbial abundance* for the organism. Currently, this will only be provided for classifications using the One Codex database and will only include estimates at the species level ([example](https://app.onecodex.com/classification/sample)). Where available, this field should provide substantially improved relative abundance estimates over read-based summaries. See [our announcement on relative abundance](https://blog.onecodex.com/2016/04/25/2-0/) for more detail on this functionality. |
| **abundance\_w\_children** *number*  | An estimated, cumulative relative microbial abundance of all of the children of a given taxon. E.g., the `abundance_w_children` for *Escherichia* is the sum of the abundances for all species in the *Escherichia* genus.                                                                                                                                                                                                                                                                                                      |

<Warning>
  **Note on future changes:** We do likely plan to add additional top-level fields to the returned JSON, e.g., whether the analysis contains abundance estimates or other similar metrics and descriptive features. We do not anticipate removing any top-level fields or fields in the table of results provided.
</Warning>


## OpenAPI

````yaml GET /api/v1/classifications/{id}/results
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/classifications/{id}/results:
    get:
      summary: GET classifications results
      operationId: get_classifications_results
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  host_tax_ids:
                    items:
                      type: string
                    title: Host Tax Ids
                    type: array
                  n_reads:
                    minimum: 1
                    title: N Reads
                    type: integer
                  table:
                    items:
                      properties:
                        abundance:
                          anyOf:
                            - maximum: 1.01
                              minimum: 0
                              type: number
                            - type: 'null'
                          title: Abundance
                        abundance_w_children:
                          anyOf:
                            - maximum: 1.01
                              minimum: 0
                              type: number
                            - type: 'null'
                          title: Abundance W Children
                        name:
                          title: Name
                          type: string
                        parent_tax_id:
                          anyOf:
                            - type: string
                            - type: 'null'
                          title: Parent Tax Id
                        rank:
                          title: Rank
                          type: string
                        readcount:
                          minimum: 0
                          title: Readcount
                          type: integer
                        readcount_w_children:
                          minimum: 0
                          title: Readcount W Children
                          type: integer
                        tax_id:
                          title: Tax Id
                          type: string
                        unfiltered_readcount:
                          anyOf:
                            - minimum: 0
                              type: integer
                            - type: 'null'
                          default: null
                          title: Unfiltered Readcount
                        unfiltered_readcount_w_children:
                          anyOf:
                            - minimum: 0
                              type: integer
                            - type: 'null'
                          default: null
                          title: Unfiltered Readcount W Children
                      required:
                        - abundance
                        - abundance_w_children
                        - name
                        - parent_tax_id
                        - rank
                        - readcount
                        - readcount_w_children
                        - tax_id
                      title: _TaxonomicResults
                      type: object
                    title: Table
                    type: array
                required:
                  - host_tax_ids
                  - n_reads
                  - table
                title: ClassificationResultsResponse
                type: object
          description: OK
components:
  securitySchemes:
    apiKeyAuth:
      in: header
      name: X-API-Key
      type: apiKey

````