Deprecation of @current in API paths

API paths that use @current in place of a project, environment, or organization ID are deprecated. Replace @current with the ID before April 30, 2027.

These paths are affected:

  • /api/projects/@current/...
  • /api/environments/@current/...
  • /api/organizations/@current/...

/api/personal_api_keys/@current/ is not affected, because it refers to the key that signs the request.

Why we're removing it

@current resolves to the project or organization that the key's user last opened in PostHog. That changes whenever the user switches projects in the app, so the same request can read from or write to a different project from one call to the next.

An ID in the path always refers to the same project or organization.

What to change

Replace @current with the project or organization ID:

diff
- GET /api/projects/@current/feature_flags/
+ GET /api/projects/12345/feature_flags/

To find the IDs:

  • Project ID: open project settings. The ID is also in the URL of any page in the app, after /project/.
  • Organization ID: open organization settings.
  • From the API: GET /api/projects/ lists the projects your key can access, with their IDs.

How to find calls that still use it

Every response to a path with @current includes these headers:

http
Deprecation: @1795564800
Sunset: Fri, 30 Apr 2027 23:59:59 GMT
Link: </api/projects/12345/feature_flags/>; rel="successor-version", <https://posthog.com/docs/api/current-alias-deprecation>; rel="deprecation"
  • Deprecation is the date the path was deprecated, in Unix seconds.
  • Sunset is the date after which the path stops resolving.
  • The successor-version link is the same request with the ID that @current resolved to. It's only included in successful responses.

Log these headers, or search your code for @current, to find the calls to change.

What happens after April 30, 2027

A request that uses @current and doesn't identify its project in another way gets an error. The error names the ID to use instead.

Requests that already identify their project

Requests authenticated with a project secret API key already identify their project, so they keep working. LLM prompt requests from the PostHog SDKs that include the project token keep working too.

Still have questions?

Was this page useful?