Suggest packages for a cohort
POST
/api/v1/policy/{registry_type}/suggest
const url = 'https://api.pkgplease.com/api/v1/policy/example/suggest';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"cohort":"logging"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”registry_type
required
string
One of the org's configured registry types (npm is the one in active use).
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
cohort
required
string
Example
loggingResponses
Section titled “Responses”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"}