मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)41k · #6858

consuming-endpoints-from-client-code

यह क्या करती है

यह स्किल दिखाती है कि मोबाइल ऐप या सर्वर जैसे अलग ऐप से PostHog एंडपॉइंट कैसे कॉल करें। यह उन डेवलपर्स के लिए है जो अपने प्रोडक्ट के अंदर PostHog डेटा इस्तेमाल करना चाहते हैं।

कब इस्तेमाल करें

  • ✓जब आप अपने ऐप या सर्वर से PostHog एंडपॉइंट कॉल करना चाहें।
  • ✓जब आपको एंडपॉइंट की OpenAPI स्पेक से टाइप्ड क्लाइंट बनवाना हो।
  • ✓जब एंडपॉइंट की कॉल प्रमाणीकरण या रेट लिमिट की त्रुटि से विफल हो।

Skill का लिंक

https://github.com/PostHog/posthog/blob/master/products/endpoints/skills/consuming-endpoints-from-client-code/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/PostHog/posthog/blob/master/products/endpoints/skills/consuming-endpoints-from-client-code/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मैं अपने मोबाइल ऐप से अपना PostHog एंडपॉइंट कैसे कॉल करूँ, और अनुरोध कैसा दिखता है?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह एंडपॉइंट की कॉन्फ़िगरेशन और OpenAPI स्पेक पढ़ती है, फिर दिखाती है कि सही auth हेडर और वेरिएबल कैसे भेजे जाएँ। यह टाइप्ड क्लाइंट बनाने के लिए कोड जनरेटर भी सुझा सकती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Consuming endpoints from client code

This skill is the caller-side counterpart to creating-an-endpoint. It helps integrate an existing endpoint into a separate codebase — a mobile app, server backend, customer dashboard, or downstream pipeline. No PostHog code is modified here.

When to use this skill

  • "How do I call my endpoint?" / "What does a request look like?"
  • "Generate a typed TypeScript / Python / Go client for this endpoint"
  • "I'm getting a 401 calling the endpoint" / auth questions
  • "The endpoint rejects my call when I omit user_id" → materialised-endpoint variable questions
  • "How do I handle rate limits?"

If the user is creating the endpoint, use creating-an-endpoint first.

Available tools

Tool Purpose
endpoint-get Full config for a named endpoint, including the query shape and required variables
endpoint-openapi-spec OpenAPI 3.0 spec for one endpoint, ready to feed to a code generator
endpoint-run A live call against the endpoint — useful to confirm a payload works before sharing it with the user's app

The endpoint URL

/api/projects/{team_id}/endpoints/{name}/run
  • team_id is the project ID (numeric). Available in PostHog under project settings, or via projects-get if the user doesn't know it.
  • name is the endpoint name — see endpoints-get-all if the user isn't sure.
  • The trailing /run is required.

POST is the canonical method. GET also works for simple cases without a request body but POST is preferred — variables go in the body.

Auth

Endpoints are authenticated with a personal API key. The header is:

Authorization: Bearer <key>

Keys are scoped — for endpoints, the key needs at least endpoint:read. If the user gets a 403, they're usually missing the scope; if they get a 401, the key is missing or malformed.

Never put a personal API key in client-side code that's shipped to end users (mobile apps, browser JS). Personal API keys grant scoped account access. For customer-facing apps, route through the user's own backend, which holds the key.

The request payload

{
  "variables": { "code_name_1": value, "code_name_2": value },
  "limit": 100,
  "offset": 0,
  "refresh": "cache"
}
Field Notes
variables Keyed by code_name for HogQL endpoints; for insight endpoints with breakdowns, key is the breakdown property name
limit Max rows returned.
offset Skip rows. Only HogQL endpoints
refresh "cache" (return cached results if fresh enough), "force" (always recalculate), "direct" (bypass materialisation, materialised endpoints only). Default is "cache"

Call endpoint-get to see the exact variable shape. The response includes the query definition with declared variables — each variable's code_name is what the client should send.

Materialised endpoints: all variables are required

If endpoint-get shows is_materialized: true on the current version, the endpoint requires every declared variable to be passed on each call. This is a security boundary — without filters, a single call would return the entire pre-aggregated dataset.

Common symptom: the user's app worked when the endpoint was unmaterialised, then started returning 400 errors after materialisation was enabled. The error message lists which variables are missing.

Optional/partial variables on materialised endpoints are a known limit

अक्सर पूछे जाने वाले सवाल

क्या यह स्किल PostHog में कुछ बदलती है?

नहीं। यह केवल किसी दूसरे कोडबेस से एंडपॉइंट से जुड़ने में मदद करती है।

क्या यह किसी भी भाषा में क्लाइंट बना सकती है?

यह TypeScript, Python और Go के लिए टाइप्ड क्लाइंट बनाना कवर करती है, openapi-generator या @hey-api/openapi-ts जैसे जनरेटर से।

अगर वेरिएबल न होने के कारण मेरी कॉल ठुकरा दी जाए तो?

स्किल बताती है कि मैटेरियलाइज़्ड एंडपॉइंट के लिए वेरिएबल किस रूप में होने चाहिए, ताकि ज़रूरी मान शामिल हों।

जानकारी

लेखक का मूल विवरण

Wire a PostHog endpoint into a client app or SDK. Covers fetching the OpenAPI spec, generating a typed client with openapi-generator or @hey-api/openapi-ts, sending the right auth header, shaping the variables payload (HogQL code_name vs insight breakdown property), handling rate-limit and materialised-endpoint error responses. Use when the user says "how do I call my endpoint", "generate a client for this", or "what auth header do I use".

repo: PostHog/posthog

लोकप्रियता

GitHub स्टार
41k
रैंकिंग में स्थान
#6858
लाइसेंस
—
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

depot-ci

41k

यह आपके एजेंट को Depot CI वर्कफ़्लो सेट अप करने, चलाने और माइग्रेट करने में मदद करती है, साथ ही रन के लॉग पढ़ने में।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

depot-container-builds

41k

यह आपके एजेंट को Depot के रिमोट बिल्डर पर Docker इमेज बनाने में मदद करती है, जिसमें मल्टी-प्लेटफ़ॉर्म इमेज और बिल्ड सुधार शामिल हैं।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

depot-github-runners

41k

यह आपके एजेंट को GitHub Actions जॉब Depot के मैनेज्ड रनर पर ले जाने, रनर का साइज़ और लेबल चुनने, और रनर सेटअप की समस्याएँ ठीक करने में मदद करती है।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

editing-agents-md

41k

यह आपके एजेंट को तय करने में मदद करती है कि कोई नियम AGENTS.md या CLAUDE.md में जाए या नहीं, और उसे ऐसे लिखे कि फ़ाइल भारी न हो।

AI और एजेंटएजेंट

मिलती-जुलती skills