The PostHog API allows you to perform any action as if you were an authenticated user utilizing the PostHog UI. It is mostly used for getting data out of PostHog, as well as other private actions such as creating a feature flag.
go get github.com/speakeasy-sdks/posthog-go-sdk
Personal API keys allow full access to your account, just like e-mail address and password, but you can create any number of them and each one can invalidated individually at any moment. This makes for greater control for you and improved security of stored data.
- How to obtain a personal API key
- Click on your name/avatar on the top right.
- Click the gear next to your name to access 'Account settings'.
- Navigate to the 'Personal API Keys' section.
- Click "+ Create a Personal API Key".
- Give your new key a label โ it's just for you, usually to describe the key's purpose.
- Click 'Create Key'.
There you go! At the top of the list you should now be seeing your brand new key. Immediately copy its value, as you'll never see it again after refreshing the page. But don't worry if you forget to copy it โ you can delete and create keys as much as you want.
package main
import (
"context"
"log"
"github.com/speakeasy-sdks/posthog-go-sdk"
"github.com/speakeasy-sdks/posthog-go-sdk/pkg/models/shared"
"github.com/speakeasy-sdks/posthog-go-sdk/pkg/models/operations"
)
func main() {
s := posthog.New()
req := operations.ActionsCountRetrieveRequest{
PathParams: operations.ActionsCountRetrievePathParams{
ID: 548814,
ProjectID: "deserunt",
},
QueryParams: operations.ActionsCountRetrieveQueryParams{
Format: "undefined",
},
}
ctx := context.Background()
res, err := s.Actions.ActionsCountRetrieve(ctx, req)
if err != nil {
log.Fatal(err)
}
if res.Action != nil {
// handle response
}
}
ActionsCountRetrieve
ActionsCreate
ActionsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueActionsList
ActionsPartialUpdate
ActionsPeopleRetrieve
ActionsRetrieve
ActionsUpdate
ActivityLogBookmarkActivityNotificationCreate
ActivityLogImportantChangesRetrieve
AnnotationsCreate
- Create, Read, Update and Delete annotations. See docs for more information on annotations.AnnotationsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueAnnotationsList
- Create, Read, Update and Delete annotations. See docs for more information on annotations.AnnotationsPartialUpdate
- Create, Read, Update and Delete annotations. See docs for more information on annotations.AnnotationsRetrieve
- Create, Read, Update and Delete annotations. See docs for more information on annotations.AnnotationsUpdate
- Create, Read, Update and Delete annotations. See docs for more information on annotations.
AppMetricsErrorDetailsRetrieve
AppMetricsHistoricalExportsRetrieve
AppMetricsHistoricalExportsRetrieve2
AppMetricsRetrieve
CohortsCreate
CohortsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueCohortsList
CohortsPartialUpdate
CohortsPersonsRetrieve
CohortsRetrieve
CohortsUpdate
DashboardTemplatesCreate
DashboardTemplatesRepositoryRetrieve
DashboardsCreate
DashboardsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueDashboardsList
DashboardsMoveTilePartialUpdate
DashboardsPartialUpdate
DashboardsRetrieve
DashboardsUpdate
DomainsCreate
DomainsDestroy
DomainsList
DomainsPartialUpdate
DomainsRetrieve
DomainsUpdate
DomainsVerifyCreate
EventDefinitionsList
EventDefinitionsPartialUpdate
EventDefinitionsRetrieve
EventDefinitionsUpdate
EventsRetrieve
EventsValuesRetrieve
ExperimentsCreate
ExperimentsDestroy
ExperimentsList
ExperimentsPartialUpdate
ExperimentsRequiresFlagImplementationRetrieve
ExperimentsResultsRetrieve
ExperimentsRetrieve
ExperimentsSecondaryResultsRetrieve
ExperimentsUpdate
ExportsContentRetrieve
ExportsCreate
ExportsRetrieve
FeatureFlagsActivityRetrieve
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsActivityRetrieve2
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsCreate
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueFeatureFlagsEvaluationReasonsRetrieve
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsList
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsLocalEvaluationRetrieve
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsMyFlagsRetrieve
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsPartialUpdate
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsRetrieve
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsRoleAccessCreate
FeatureFlagsRoleAccessDestroy
FeatureFlagsRoleAccessList
FeatureFlagsRoleAccessRetrieve
FeatureFlagsUpdate
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
FeatureFlagsUserBlastRadiusCreate
- Create, read, update and delete feature flags. See docs for more information on feature flags.
If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.
Funnels
GroupsFindRetrieve
GroupsList
GroupsPropertyDefinitionsRetrieve
GroupsPropertyValuesRetrieve
GroupsRelatedRetrieve
GroupsTypesList
GroupsTypesUpdateMetadataPartialUpdate
HooksCreate
- Retrieve, create, update or destroy REST hooks.HooksDestroy
- Retrieve, create, update or destroy REST hooks.HooksList
- Retrieve, create, update or destroy REST hooks.HooksPartialUpdate
- Retrieve, create, update or destroy REST hooks.HooksRetrieve
- Retrieve, create, update or destroy REST hooks.HooksUpdate
- Retrieve, create, update or destroy REST hooks.
IngestionWarningsRetrieve
Funnels
Trends
InsightsActivityRetrieve
InsightsActivityRetrieve2
InsightsCancelCreate
InsightsCreate
InsightsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueInsightsFunnelCorrelationCreate
InsightsFunnelCorrelationRetrieve
InsightsFunnelRetrieve
InsightsList
InsightsMyLastViewedRetrieve
- Returns basic details about the last 5 insights viewed by this user. Most recently viewed first.InsightsPartialUpdate
InsightsPathCreate
InsightsPathRetrieve
InsightsRetentionRetrieve
InsightsRetrieve
InsightsTimingCreate
InsightsTrendRetrieve
InsightsUpdate
InsightsViewedCreate
IntegrationsChannelsRetrieve
IntegrationsCreate
IntegrationsDestroy
IntegrationsList
IntegrationsRetrieve
InvitesBulkCreate
InvitesCreate
InvitesDestroy
InvitesList
IsGeneratingDemoDataRetrieve
- Projects for the current organization.
MembersDestroy
MembersList
MembersPartialUpdate
MembersUpdate
DomainsCreate
DomainsDestroy
DomainsList
DomainsPartialUpdate
DomainsRetrieve
DomainsUpdate
DomainsVerifyCreate
InvitesBulkCreate
InvitesCreate
InvitesDestroy
InvitesList
MembersDestroy
MembersList
MembersPartialUpdate
MembersUpdate
PluginsActivityRetrieve
PluginsCheckForUpdatesRetrieve
PluginsCreate
PluginsDestroy
PluginsList
PluginsPartialUpdate
PluginsRepositoryRetrieve
PluginsRetrieve
PluginsSourceRetrieve
PluginsUpdate
PluginsUpdateSourcePartialUpdate
PluginsUpgradeCreate
ResourceAccessCreate
ResourceAccessDestroy
ResourceAccessList
ResourceAccessPartialUpdate
ResourceAccessRetrieve
ResourceAccessUpdate
RolesCreate
RolesDestroy
RolesList
RolesPartialUpdate
RolesRetrieve
RolesRoleMembershipsCreate
RolesRoleMembershipsDestroy
RolesRoleMembershipsList
RolesUpdate
PerformanceEventsList
PerformanceEventsRecentPageviewsRetrieve
PersonsActivityRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsActivityRetrieve2
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsCohortsRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsDeletePropertyCreate
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsDestroy
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsFunnelCorrelationCreate
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsFunnelCorrelationRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsFunnelCreate
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsFunnelRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsLifecycleRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsPartialUpdate
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsPathCreate
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsPathRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsPropertiesRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsPropertiesTimelineRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsRetentionRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsSplitCreate
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsStickinessRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsTrendsRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsUpdate
- Only for setting properties on the person. "properties" from the request data will be updated via a "$set" event. This means that only the properties listed will be updated, but other properties won't be removed nor updated. If you would like to remove a property use thedelete_property
endpoint.PersonsUpdatePropertyCreate
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.PersonsValuesRetrieve
- To create or update persons, use a PostHog library of your choice and use an identify call. This API endpoint is only for reading and deleting.
PluginConfigsCreate
PluginConfigsDestroy
PluginConfigsFrontendRetrieve
PluginConfigsJobCreate
PluginConfigsList
PluginConfigsLogsList
PluginConfigsPartialUpdate
PluginConfigsRearrangePartialUpdate
PluginConfigsRetrieve
PluginConfigsUpdate
PluginsActivityRetrieve
PluginsCheckForUpdatesRetrieve
PluginsCreate
PluginsDestroy
PluginsList
PluginsPartialUpdate
PluginsRepositoryRetrieve
PluginsRetrieve
PluginsSourceRetrieve
PluginsUpdate
PluginsUpdateSourcePartialUpdate
PluginsUpgradeCreate
Create
- Projects for the current organization.Destroy
- Projects for the current organization.List
- Projects for the current organization.PartialUpdate
- Projects for the current organization.Retrieve
- Projects for the current organization.Update
- Projects for the current organization.
PromptsMyPromptsPartialUpdate
- Create, read, update and delete prompt sequences state for a person.PromptsMyPromptsPartialUpdate
- Create, read, update and delete prompt sequences state for a person.
PropertyDefinitionsList
PropertyDefinitionsPartialUpdate
PropertyDefinitionsRetrieve
PropertyDefinitionsUpdate
QueryRetrieve
ResetTokenPartialUpdate
- Projects for the current organization.
ResourceAccessCreate
ResourceAccessDestroy
ResourceAccessList
ResourceAccessPartialUpdate
ResourceAccessRetrieve
ResourceAccessUpdate
RolesCreate
RolesDestroy
RolesList
RolesPartialUpdate
RolesRetrieve
RolesRoleMembershipsCreate
RolesRoleMembershipsDestroy
RolesRoleMembershipsList
RolesUpdate
SessionRecordingPlaylistsCreate
SessionRecordingPlaylistsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueSessionRecordingPlaylistsList
SessionRecordingPlaylistsPartialUpdate
SessionRecordingPlaylistsRecordingsCreate
SessionRecordingPlaylistsRecordingsDestroy
SessionRecordingPlaylistsRecordingsRetrieve
SessionRecordingPlaylistsRetrieve
SessionRecordingPlaylistsUpdate
SessionRecordingsPropertiesRetrieve
SessionRecordingsRetrieve
SessionRecordingsRetrieve2
SessionRecordingsSnapshotsRetrieve
SubscriptionsCreate
SubscriptionsDestroy
- Hard delete of this model is not allowed. Use a patch API call to set "deleted" to trueSubscriptionsList
SubscriptionsPartialUpdate
SubscriptionsRetrieve
SubscriptionsUpdate
TagsList
Trends
-
UploadedMediaCreate
- When object storage is available this API allows upload of media which can be used, for example, in text cards on dashboards.Uploaded media must have a content type beginning with 'image/' and be less than 4MB.