openapi: 3.1.0 info: title: Trefle Distributions Kingdoms API description: Trefle is an open, freely accessible botanical data source and REST API for plant information. The API provides access to data on kingdoms, subkingdoms, divisions, plant families, genus, plant species, and geographic distributions. Over 400,000 plant species are available. Authentication uses a personal access token passed as a query parameter or Authorization header. version: 1.0.0 contact: name: Trefle Support url: https://trefle.io license: name: MIT url: https://github.com/treflehq/trefle-api/blob/master/LICENSE servers: - url: https://trefle.io/api/v1 description: Trefle Production API security: - tokenAuth: [] tags: - name: Kingdoms description: Retrieve botanical kingdom classification data. paths: /kingdoms: get: operationId: listKingdoms summary: List Kingdoms description: Returns a list of botanical kingdoms in the Trefle taxonomy. tags: - Kingdoms responses: '200': description: Kingdoms returned content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/TaxonomyEntry' '401': $ref: '#/components/responses/Unauthorized' /kingdoms/{id}: get: operationId: getKingdom summary: Get Kingdom description: Retrieves details of a specific botanical kingdom. tags: - Kingdoms parameters: - name: id in: path required: true schema: type: string responses: '200': description: Kingdom returned content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/TaxonomyEntry' '401': $ref: '#/components/responses/Unauthorized' components: schemas: TaxonomyEntry: type: object properties: id: type: integer name: type: string slug: type: string links: type: object responses: Unauthorized: description: Authentication failed. Access token missing, invalid, or expired. content: application/json: schema: type: object properties: error: type: string message: type: string securitySchemes: tokenAuth: type: apiKey in: query name: token description: 'Trefle personal access token obtained by registering at trefle.io. Can be passed as a query parameter (?token=YOUR_TOKEN) or in the Authorization header (Authorization: Bearer YOUR_TOKEN).'