Skip to content

Suggest packages for a cohort

POST
/api/v1/policy/{registry_type}/suggest
curl --request POST \
--url https://api.pkgplease.com/api/v1/policy/example/suggest \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "cohort": "logging" }'

Backs the MCP suggest_allowed tool. Takes a cohort slug from GET /api/v1/cohorts/{registry_type} and returns, first, the members this org endorses (its declared standard), then other reviewed members its policy currently allows. A member the org would block, ask about, warn on or steer away from is never listed; it is counted in excluded. At most 10 members are evaluated per call.

registry_type
required
string

One of the org's configured registry types (npm is the one in active use).

Media typeapplication/json
object
cohort
required
string
Example
logging

The two tiers for the cohort

Media typeapplication/json
object
cohort
object
slug
string
name
string
description
string
endorsed
Array<object>
object
package
string
version
string
range
string
reason
string
scored
boolean
permitted
Array<object>
object
package
string
version
string
scored

False when pkgPlease has not scored this version yet

boolean
excluded
integer
Examplegenerated
{
"cohort": {
"slug": "example",
"name": "example",
"description": "example"
},
"endorsed": [
{
"package": "example",
"version": "example",
"range": "example",
"reason": "example",
"scored": true
}
],
"permitted": [
{
"package": "example",
"version": "example",
"scored": true
}
],
"excluded": 1
}

Missing or unknown cohort; the message lists the valid slugs

Media typeapplication/json
object
error
required
string
Examplegenerated
{
"error": "example"
}