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

# Route Discovery

> Discover available post-upload processing routes

## Overview

The route discovery endpoint returns a list of available API routes that can be called after a file upload completes. This allows integrations (like the WordPress plugin) to dynamically discover what processing options are available.

<Note>
  This endpoint is **public** and does not require authentication. This allows clients to discover available routes before the user authenticates.
</Note>

## Request

```bash theme={"theme":"github-dark"}
curl https://api.superseeded.ai/v1/routes/from-upload
```

No request body or authentication is required.

## Response

<ResponseField name="routes" type="array" required>
  List of available post-upload processing routes

  <Expandable title="Route object properties">
    <ResponseField name="id" type="string" required>
      Unique route identifier (e.g., `verify-pot-sizes`)
    </ResponseField>

    <ResponseField name="name" type="string" required>
      Human-readable route name for display in UIs
    </ResponseField>

    <ResponseField name="description" type="string" required>
      Description of what this route does
    </ResponseField>

    <ResponseField name="endpoint" type="string" required>
      Full API endpoint path (e.g., `/v1/verify/pot-sizes`)
    </ResponseField>

    <ResponseField name="method" type="string" required>
      HTTP method (`POST`, `GET`, etc.)
    </ResponseField>

    <ResponseField name="requires_auth" type="boolean" required>
      Whether the route requires a delegation token
    </ResponseField>

    <ResponseField name="accepted_file_types" type="array" required>
      File extensions this route can process (e.g., `[".json"]`)
    </ResponseField>

    <ResponseField name="category" type="string">
      Optional category for grouping routes (e.g., `enrichment`, `validation`)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="version" type="string" required>
  API version for the route schema (currently `1.0`)
</ResponseField>

## Example Response

```json theme={"theme":"github-dark"}
{
  "routes": [
    {
      "id": "verify-pot-sizes",
      "name": "Verify Pot Sizes",
      "description": "Classify pot sizes and plant specifications into Growth Equivalent Hierarchy categories",
      "endpoint": "/v1/verify/pot-sizes",
      "method": "POST",
      "requires_auth": true,
      "accepted_file_types": [".json", ".xlsx", ".xls", ".pdf", ".txt", ".png", ".jpg", ".jpeg", ".gif", ".webp"],
      "category": "enrichment"
    }
  ],
  "version": "1.0"
}
```

## Usage

### WordPress Plugin

The WordPress plugin uses this endpoint to populate the "Post-Upload Processing" settings field. Routes are cached for 1 hour using WordPress transients.

```php theme={"theme":"github-dark"}
$response = wp_remote_get('https://api.superseeded.ai/v1/routes/from-upload');
$body = json_decode(wp_remote_retrieve_body($response), true);
$routes = $body['routes'];
```

### JavaScript

Frontend integrations can fetch available routes to build dynamic UIs:

```javascript theme={"theme":"github-dark"}
fetch('https://api.superseeded.ai/v1/routes/from-upload')
  .then(response => response.json())
  .then(data => {
    data.routes.forEach(route => {
      console.log(`${route.name}: ${route.description}`);
    });
  });
```

### Calling Discovered Routes

After discovering routes, call them with the file URL and delegation token:

```javascript theme={"theme":"github-dark"}
// For each enabled route
const response = await fetch(apiBaseUrl + route.endpoint, {
  method: route.method,
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + delegationToken  // if requires_auth is true
  },
  body: JSON.stringify({ file_url: uploadedFileUrl })
});
```

## Caching Recommendations

* **Cache duration**: Routes rarely change, so cache for 1-24 hours
* **Cache invalidation**: Provide a manual refresh option for administrators
* **Fallback**: If the endpoint is unreachable, use a hardcoded default route list


## OpenAPI

````yaml GET /routes/from-upload
openapi: 3.1.0
info:
  title: Superseeded API
  description: >-
    Modern nursery industry API for reconciling plant specifications, resolving
    equivalence and assessing logistical risks for plant stock.
  version: 1.0.0
  license:
    name: MIT
  contact:
    name: Superseeded Support
servers:
  - url: https://api.superseeded.ai/v1
    description: Production Server
security: []
tags:
  - name: Resolvers
    description: Endpoints for cleaning, normalizing, and interpreting messy nursery data.
  - name: Validation
    description: >-
      Endpoints for validating botanical species names against taxonomic
      databases.
  - name: Flowers
    description: >-
      Search flowers by color using spectral reflectance data from the Floral
      Reflectance Database (FReD).
  - name: System
    description: Health checks and service status.
  - name: Images
    description: Resolve public catalog image URLs for storefront and product integrations.
paths:
  /routes/from-upload:
    get:
      tags:
        - System
      summary: Route Discovery
      description: >-
        Returns a list of available API routes that can be called after a file
        upload completes. This allows integrations to dynamically discover what
        processing options are available.
      operationId: getRoutesFromUpload
      responses:
        '200':
          description: List of available post-upload processing routes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RouteDiscoveryResponse'
components:
  schemas:
    RouteDiscoveryResponse:
      type: object
      properties:
        routes:
          type: array
          description: List of available post-upload processing routes
          items:
            $ref: '#/components/schemas/Route'
        version:
          type: string
          description: API version for the route schema
          example: '1.0'
      example:
        routes:
          - id: verify-pot-sizes
            name: Verify Pot Sizes
            description: >-
              Classify pot sizes and plant specifications into Growth Equivalent
              Hierarchy categories
            endpoint: /v1/verify/pot-sizes
            method: POST
            requires_auth: true
            accepted_file_types:
              - .json
              - .xlsx
              - .xls
              - .pdf
              - .txt
              - .png
              - .jpg
              - .jpeg
              - .gif
              - .webp
            category: enrichment
        version: '1.0'
    Route:
      type: object
      properties:
        id:
          type: string
          description: Unique route identifier
          example: verify-pot-sizes
        name:
          type: string
          description: Human-readable route name for display in UIs
          example: Resolve Specifications
        description:
          type: string
          description: Description of what this route does
          example: >-
            Classify pot sizes and plant specifications into Growth Equivalent
            Hierarchy categories
        endpoint:
          type: string
          description: Full API endpoint path
          example: /v1/verify/pot-sizes
        method:
          type: string
          description: HTTP method
          example: POST
        requires_auth:
          type: boolean
          description: Whether the route requires a delegation token
          example: true
        accepted_file_types:
          type: array
          description: File extensions this route can process
          items:
            type: string
          example:
            - .json
            - .xlsx
            - .xls
            - .pdf
            - .txt
            - .png
            - .jpg
            - .jpeg
            - .gif
            - .webp
        category:
          type: string
          description: Optional category for grouping routes
          example: enrichment

````