Originally published at: Introducing the new API for OSI Approved Licenses® – Open Source Initiative
The Open Source Initiative (OSI) is excited to announce the availability of a new API service providing access to the canonical list of OSI Approved Licenses®. This service is fully public and free to use.
This is great - thanks for making this happen!
As discussed starting here, it would be fantastic if this API supported literal SPDX license identifiers in the API URLs e.g. https://opensource.org/api/license/GPL-2.0
. Furthermore it would be ideal if the SPDX identifier portion of these URLs was case insensitive, to align with the SPDX specification i.e. these API URLs should all resolve to the same endpoint:
https://opensource.org/api/license/GPL-2.0
https://opensource.org/api/license/gpl-2.0
https://opensource.org/api/license/gPl-2.0
There’s a slightly tricky corner case around some of the deprecated SPDX identifiers for FSF-published licenses that end in +
(e.g. GPL-2.0+
) - it would be ideal if these identifiers were supported too, so that API clients aren’t forced to upgrade these deprecated identifiers to their non-deprecated equivalents (e.g. GPL-2.0-or-later
) in order to use the API.
The SPDX project has stated that they will never add any new license identifiers that end in +
(they consider this to have been a historical mistake), so the set of such identifiers is fixed and small (there are 6 of them).
Initial documentation provided by Automattic developer (Glynn Quelch) who led the project:
OpenSource Licenses API Documentation
Overview
The OpenSource Licenses API provides access to information about open source licenses approved by the Open Source Initiative (OSI). This RESTful API allows developers to retrieve license information, filter licenses by various criteria, and access detailed license metadata.
Base URL: https://opensource.org/api
Authentication
No authentication is required for this API. All endpoints are publicly accessible.
Endpoints
1. Get All Licenses
Retrieves a list of all public/published licenses.
Endpoint: GET /licenses
Description: Gets all the public/published licenses
Response: Array of license objects
Example Request:
GET https://opensource.org/api/licenses
Example Response:
[
{
"id": "mit",
"name": "The MIT License",
"spdx_id": "MIT",
"version": "N/A",
"submission_date": "",
"submission_url": "",
"submitter_name": "",
"approved": false,
"approval_date": "",
"license_steward_version": "",
"license_steward_url": "",
"board_minutes": "",
"stewards": [],
"keywords": ["popular-strong-community"],
"_links": {
"self": {
"href": "https://opensource.org/api/license/mit"
},
"html": {
"href": "https://opensource.org/license/mit"
},
"collection": {
"href": "https://opensource.org/api/licenses"
}
}
}
]
2. Filter Licenses by Name
Filters licenses by name (partial match).
Endpoint: GET /licenses?name={name}
Parameters:
name
(string): Filter licenses whose name contains the specified text
Description: Filters any license whose name contains the specified text
Example Request:
GET https://opensource.org/api/licenses?name=mit
Example Response:
Returns licenses with names containing “mit”, such as:
- MIT No Attribution License
- MITRE Collaborative Virtual Workspace License
- The MIT License
3. Filter Licenses by Keywords
Filters licenses by specific keywords.
Endpoint: GET /licenses?keyword={keyword}
Parameters:
keyword
(string): Filter licenses by keyword
Available Keywords:
popular-strong-community
international
special-purpose
non-reusable
superseded
voluntarily-retired
redundant-with-more-popular
other-miscellaneous
uncategorized
Example Request:
GET https://opensource.org/api/licenses?keyword=popular-strong-community
Example Response:
Returns popular licenses with strong community support, including:
- Apache License 2.0
- MIT License
- GNU GPL v2/v3
- BSD licenses
- Mozilla Public License 2.0
4. Filter Licenses by Steward
Filters licenses by their steward organization.
Endpoint: GET /licenses?steward={steward}
Parameters:
steward
(string): Filter licenses by steward organization
Common Stewards:
eclipse-foundation
free-software-foundation
mozilla-foundation
apache-software-foundation
python-software-foundation
Example Request:
GET https://opensource.org/api/licenses?steward=eclipse-foundation
Example Response:
Returns licenses stewarded by the Eclipse Foundation:
- Eclipse Public License version 2.0
- Eclipse Public License v1.0
5. Filter Licenses by SPDX ID
Filters licenses by their SPDX identifier with wildcard support.
Endpoint: GET /licenses?spdx={spdx_pattern}
Parameters:
spdx
(string): Filter licenses by SPDX identifier (supports wildcards with*
)
Description: Filters licenses by their SPDX identifier. Supports wildcard matching using the *
character for flexible pattern matching.
Wildcard Patterns:
prefix*
- Find licenses that start with the prefix*suffix
- Find licenses that end with the suffix*contains*
- Find licenses that contain the text anywhereexact
- Find licenses with exact match (no wildcards)
Example Request:
GET https://opensource.org/api/licenses?spdx=gpl*
Example Response:
Returns licenses with SPDX IDs starting with “gpl”, such as:
- GNU General Public License version 3 (GPL-3.0-only)
- GNU General Public License version 2 (GPL-2.0)
Additional Examples:
?spdx=mit*
- Find all that start with “mit”?spdx=*bsd
- Find all that end in “bsd”?spdx=*apache*
- Find any that contain “apache”?spdx=mit
- Only an exact match for “mit”
Response Schema
License Object
Each license object contains the following fields:
Field | Type | Description |
---|---|---|
id |
string | Unique identifier for the license |
name |
string | Full name of the license |
spdx_id |
string | SPDX identifier for the license |
version |
string | License version |
submission_date |
string | Date when license was submitted (YYYYMMDD format) |
submission_url |
string | URL of the original submission |
submitter_name |
string | Name of the person who submitted the license |
approved |
boolean | Whether the license is approved by OSI |
approval_date |
string | Date when license was approved (YYYYMMDD format) |
license_steward_version |
string | Version maintained by steward |
license_steward_url |
string | URL to steward’s license page |
board_minutes |
string | URL to board meeting minutes |
stewards |
array | Organizations that steward this license |
keywords |
array | Classification keywords for the license |
_links |
object | HATEOAS links for related resources |
Links Object
The _links
object contains:
Field | Description |
---|---|
self.href |
API endpoint for this specific license |
html.href |
Human-readable web page for this license |
collection.href |
API endpoint for the licenses collection |
HTTP Status Codes
Code | Description |
---|---|
200 | OK - Request successful |
400 | Bad Request - Invalid parameters |
404 | Not Found - Resource not found |
500 | Internal Server Error - Server error |
Rate Limiting
No specific rate limiting information is documented. Standard usage practices apply.
Examples
Get all MIT-related licenses
curl "https://opensource.org/api/licenses?name=mit"
Get all popular licenses
curl "https://opensource.org/api/licenses?keyword=popular-strong-community"
Get all GNU licenses
curl "https://opensource.org/api/licenses?steward=free-software-foundation"
Get all GPL licenses using SPDX wildcard
curl "https://opensource.org/api/licenses?spdx=gpl*"
Get all BSD licenses using SPDX wildcard
curl "https://opensource.org/api/licenses?spdx=bsd*"
Notes
- All responses are in JSON format
- The API uses standard HTTP methods and status codes
- Responses include HATEOAS links for navigation
- Date fields use YYYYMMDD format
- Empty fields may be represented as empty strings rather than null values
- The
approved
field appears to be consistentlyfalse
in the sample data, likely indicating a data formatting convention rather than actual approval status
Support
For questions or issues with the API, please reach out to us. Thanks!