Skip to content

fix(api-v2): correct endpoints and request bodies to match REST API v2#1

Merged
AndroidPoet merged 1 commit into
masterfrom
fix/api-v2-corrections
Jun 11, 2026
Merged

fix(api-v2): correct endpoints and request bodies to match REST API v2#1
AndroidPoet merged 1 commit into
masterfrom
fix/api-v2-corrections

Conversation

@AndroidPoet

Copy link
Copy Markdown
Owner

Summary

Compared the CLI against the official RevenueCat REST API v2 OpenAPI spec and fixed discrepancies that would cause live requests to fail.

Fixes (endpoint-by-endpoint)

Command Was Now Symptom
apps api-keys GET /apps/{id}/api_keys GET /apps/{id}/public_api_keys 404
entitlements update PATCH /entitlements/{id} POST /entitlements/{id} 405
customers create body {"app_user_id": ...} body {"id": ...} 400 (missing required id)
customers grant-entitlement body {entitlement_id} only body {entitlement_id, expires_at} + new --expires-at flag 400 (missing required expires_at)

Verified correct (left unchanged)

  • Customer action slugs: grant_entitlement, revoke_granted_entitlement, assign_offering
  • Flat package attach/detach paths: /packages/{id}/actions/{attach,detach}_products
  • Package attach product association shape: product_id + eligibility_criteria=all
  • Pagination (limit / starting_after / next_page), Bearer auth, base URL https://api.revenuecat.com/v2, Content-Type: application/json

Testing

go build ./..., go vet ./..., and go test ./... all pass.

…2 spec

Verified against the official RevenueCat OpenAPI v2 spec and fixed
discrepancies that caused requests to fail (404/405/400):

- apps api-keys: path was /apps/{id}/api_keys -> /apps/{id}/public_api_keys
  (matches GET /projects/{project_id}/apps/{app_id}/public_api_keys)
- entitlements update: used HTTP PATCH -> POST
  (spec defines POST /projects/{project_id}/entitlements/{entitlement_id})
- customers create: request body field app_user_id -> id
  (spec requires the `id` field; app_user_id was rejected as missing-required)
- customers grant-entitlement: added required `expires_at` field and a new
  --expires-at flag (ms since epoch); the API requires both entitlement_id
  and expires_at, so grants previously failed validation

Verified correct and left unchanged: customer action slugs
(grant_entitlement / revoke_granted_entitlement / assign_offering),
flat package attach/detach paths, package attach product association shape
(product_id + eligibility_criteria=all), pagination (limit/starting_after/
next_page), Bearer auth, and base URL.
@AndroidPoet AndroidPoet merged commit 5be018f into master Jun 11, 2026
2 checks passed
@AndroidPoet AndroidPoet deleted the fix/api-v2-corrections branch June 11, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant