OpenAPI Specification
openapi: 3.0.3
info:
title: Lens Patents API
description: The Lens API provides programmatic access to the full corpus of Lens scholarly works and patents using a REST interface. The API supports rich Elasticsearch-style query DSL for searching scholarly publications and global patent records, with cursor-based pagination, sorting, and field projection. Authentication is via a bearer token issued from the Lens user profile.
version: '1.0'
contact:
name: Lens API Support
url: https://docs.api.lens.org/
license:
name: Lens API Terms
url: https://www.lens.org/lens/terms-and-conditions
servers:
- url: https://api.lens.org
description: Lens production API
security:
- bearerAuth: []
tags:
- name: Patents
description: Search and retrieve global patent records.
paths:
/patent/search:
get:
tags:
- Patents
summary: Search patents (GET)
description: Search the Lens patents index using URL query parameters. Use the POST variant for complex Boolean queries, cursor pagination, family grouping, and stemming controls.
parameters:
- name: query
in: query
required: true
description: Lucene-style query string.
schema:
type: string
- name: size
in: query
schema:
type: integer
default: 20
- name: from
in: query
schema:
type: integer
default: 0
- name: sort
in: query
schema:
type: string
- name: include
in: query
schema:
type: string
- name: exclude
in: query
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PatentResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
post:
tags:
- Patents
summary: Search patents (POST)
description: Submit a structured query against the Lens patents index. Supports the full Elasticsearch-style query DSL plus patent-specific parameters such as `group_by` and `expand_by` for patent family operations, `stemming`, `language`, `regex`, and `min_score`.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PatentRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PatentResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
/patent/{lens_id}:
get:
tags:
- Patents
summary: Get a patent by Lens ID
description: Retrieve a single patent record by its unique Lens identifier.
parameters:
- name: lens_id
in: path
required: true
description: Unique Lens identifier for the patent record.
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PatentRecord'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
components:
schemas:
SearchRequestBase:
type: object
properties:
query:
description: Elasticsearch-style query DSL object.
type: object
additionalProperties: true
sort:
type: array
items:
type: object
additionalProperties: true
include:
type: array
items:
type: string
exclude:
type: array
items:
type: string
size:
type: integer
default: 20
from:
type: integer
default: 0
scroll:
type: string
description: Lifespan for cursor-based pagination (e.g. "1m").
scroll_id:
type: string
description: Cursor returned by a previous response for pagination.
min_score:
type: number
stemming:
type: boolean
default: true
regex:
type: boolean
default: false
required:
- query
SearchResponseBase:
type: object
properties:
total:
type: integer
results:
type: integer
scroll_id:
type: string
data:
type: array
items:
type: object
additionalProperties: true
PatentRequest:
allOf:
- $ref: '#/components/schemas/SearchRequestBase'
- type: object
properties:
group_by:
type: string
description: Group results by patent family (e.g. "family").
expand_by:
type: string
language:
type: string
description: Language code for multi-lingual matching.
PatentRecord:
type: object
description: A patent record (Lens patent schema v1.6.5).
properties:
lens_id:
type: string
jurisdiction:
type: string
doc_number:
type: string
kind:
type: string
date_published:
type: string
format: date
publication_type:
type: string
biblio:
type: object
properties:
invention_title:
type: array
items:
type: object
properties:
text:
type: string
lang:
type: string
parties:
type: object
properties:
applicants:
type: array
items:
type: object
inventors:
type: array
items:
type: object
classifications_ipcr:
type: array
items:
type: object
classifications_cpc:
type: array
items:
type: object
abstract:
type: array
items:
type: object
claims:
type: array
items:
type: object
families:
type: object
Error:
type: object
properties:
message:
type: string
code:
type: integer
PatentResponse:
allOf:
- $ref: '#/components/schemas/SearchResponseBase'
- type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/PatentRecord'
responses:
RateLimited:
description: Plan quota or rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Missing or invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Malformed request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Record not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: API token issued from the Lens user profile (Plans & Tokens).