Schematic API
For more information, please visit https://schematichq.com.
PHP 7.4 and later. Should also work with PHP 8.0.
You can install the Schematic PHP SDK via Composer. Run the following command in your project directory:
composer require schematichq/schematic-php
To initialize the Schematic client, provide a secret API key; you can issue an API key in the API Keys section of settings in the Schematic web app.
<?php
require_once 'vendor/autoload.php';
use Schematic\Schematic;
$schematic = new Schematic('YOUR_SECRET_API_KEY');
Once you have initialized the Schematic client, you can make API calls using the various API classes provided by the SDK.
$companies = $schematic->CompaniesApi->listCompanies();
The SDK throws exceptions in case of API errors. You can catch and handle these exceptions in your code:
try {
$companies = $schematic->CompaniesApi->listCompanies();
// Process the companies
} catch (\Exception $e) {
// Handle the exception
echo 'Error: ' . $e->getMessage();
}
The following Schematic API endpoints are accessible via this client library. All URIs are relative to https://api.schematichq.com
Class | Method | HTTP request | Description |
---|---|---|---|
AccountsApi | countApiKeys | GET /api-keys/count | Count api keys |
AccountsApi | countApiRequests | GET /api-requests/count | Count api requests |
AccountsApi | createApiKey | POST /api-keys | Create api key |
AccountsApi | createEnvironment | POST /environments | Create environment |
AccountsApi | deleteApiKey | DELETE /api-keys/{api_key_id} | Delete api key |
AccountsApi | deleteEnvironment | DELETE /environments/{environment_id} | Delete environment |
AccountsApi | getApiKey | GET /api-keys/{api_key_id} | Get api key |
AccountsApi | getApiRequest | GET /api-requests/{api_request_id} | Get api request |
AccountsApi | getEnvironment | GET /environments/{environment_id} | Get environment |
AccountsApi | listApiKeys | GET /api-keys | List api keys |
AccountsApi | listApiRequests | GET /api-requests | List api requests |
AccountsApi | updateApiKey | PUT /api-keys/{api_key_id} | Update api key |
AccountsApi | updateEnvironment | PUT /environments/{environment_id} | Update environment |
CompaniesApi | createCompany | POST /companies/create | Create company |
CompaniesApi | createUser | POST /users/create | Create user |
CompaniesApi | deleteCompany | DELETE /companies/{company_id} | Delete company |
CompaniesApi | deleteCompanyByKeys | POST /companies/delete | Delete company by keys |
CompaniesApi | deleteCompanyMembership | DELETE /company-memberships/{company_membership_id} | Delete company membership |
CompaniesApi | deleteUser | DELETE /users/{user_id} | Delete user |
CompaniesApi | deleteUserByKeys | POST /users/delete | Delete user by keys |
CompaniesApi | getCompany | GET /companies/{company_id} | Get company |
CompaniesApi | getOrCreateCompanyMembership | POST /company-memberships | Get or create company membership |
CompaniesApi | getOrCreateEntityTraitDefinition | POST /entity-trait-definitions | Get or create entity trait definition |
CompaniesApi | getUser | GET /users/{user_id} | Get user |
CompaniesApi | listCompanies | GET /companies | List companies |
CompaniesApi | listCompanyMemberships | GET /company-memberships | List company memberships |
CompaniesApi | listCompanyPlans | GET /company-plans | List company plans |
CompaniesApi | listUsers | GET /users | List users |
CompaniesApi | lookupCompany | GET /companies/lookup | Lookup company |
CompaniesApi | lookupUser | GET /users/lookup | Lookup user |
CompaniesApi | updateEntityTraitDefinition | PUT /entity-trait-definitions/{entity_trait_definition_id} | Update entity trait definition |
CompaniesApi | upsertCompany | POST /companies | Upsert company |
CompaniesApi | upsertCompanyTrait | POST /company-traits | Upsert company trait |
CompaniesApi | upsertUser | POST /users | Upsert user |
CompaniesApi | upsertUserTrait | POST /user-traits | Upsert user trait |
EntitlementsApi | createCompanyOverride | POST /company-overrides | Create company override |
EntitlementsApi | createPlanEntitlement | POST /plan-entitlements | Create plan entitlement |
EntitlementsApi | deleteCompanyOverride | DELETE /company-overrides/{company_override_id} | Delete company override |
EntitlementsApi | deletePlanEntitlement | DELETE /plan-entitlements/{plan_entitlement_id} | Delete plan entitlement |
EntitlementsApi | getCompanyOverride | GET /company-overrides/{company_override_id} | Get company override |
EntitlementsApi | getPlanEntitlement | GET /plan-entitlements/{plan_entitlement_id} | Get plan entitlement |
EntitlementsApi | listCompanyOverrides | GET /company-overrides | List company overrides |
EntitlementsApi | listPlanEntitlements | GET /plan-entitlements | List plan entitlements |
EntitlementsApi | updateCompanyOverride | PUT /company-overrides/{company_override_id} | Update company override |
EntitlementsApi | updatePlanEntitlement | PUT /plan-entitlements/{plan_entitlement_id} | Update plan entitlement |
EventsApi | countEventSummaries | GET /event-types/count | Count event summaries |
EventsApi | countEvents | GET /events/count | Count events |
EventsApi | createEvent | POST /events | Create event |
EventsApi | createEventBatch | POST /event-batch | Create event batch |
EventsApi | getEvent | GET /events/{event_id} | Get event |
EventsApi | getEventSummaries | GET /event-types | Get event summaries |
EventsApi | getEventSummaryBySubtype | GET /event-types/{key} | Get event summary by subtype |
EventsApi | listEvents | GET /events | List events |
EventsApi | listMetricCounts | GET /metric-counts | List metric counts |
FeaturesApi | checkFlag | POST /flags/{key}/check | Check flag |
FeaturesApi | checkFlags | POST /flags/check | Check flags |
FeaturesApi | countAudienceCompanies | POST /audience/count-companies | Count audience companies |
FeaturesApi | countAudienceUsers | POST /audience/count-users | Count audience users |
FeaturesApi | countFlagChecks | GET /flag-checks/count | Count flag checks |
FeaturesApi | createFeature | POST /features | Create feature |
FeaturesApi | createFlag | POST /flags | Create flag |
FeaturesApi | deleteFeature | DELETE /features/{feature_id} | Delete feature |
FeaturesApi | deleteFlag | DELETE /flags/{flag_id} | Delete flag |
FeaturesApi | getFeature | GET /features/{feature_id} | Get feature |
FeaturesApi | getFlag | GET /flags/{flag_id} | Get flag |
FeaturesApi | getFlagCheck | GET /flag-checks/{flag_check_id} | Get flag check |
FeaturesApi | getLatestFlagChecks | GET /flag-checks/latest | Get latest flag checks |
FeaturesApi | listAudienceCompanies | POST /audience/get-companies | List audience companies |
FeaturesApi | listAudienceUsers | POST /audience/get-users | List audience users |
FeaturesApi | listFeatures | GET /features | List features |
FeaturesApi | listFlagChecks | GET /flag-checks | List flag checks |
FeaturesApi | listFlags | GET /flags | List flags |
FeaturesApi | updateFeature | PUT /features/{feature_id} | Update feature |
FeaturesApi | updateFlag | PUT /flags/{flag_id} | Update flag |
FeaturesApi | updateFlagRules | PUT /flags/{flag_id}/rules | Update flag rules |
PlansApi | createPlan | POST /plans | Create plan |
PlansApi | deleteAudience | DELETE /plan-audiences/{plan_audience_id} | Delete audience |
PlansApi | deletePlan | DELETE /plans/{plan_id} | Delete plan |
PlansApi | getPlan | GET /plans/{plan_id} | Get plan |
PlansApi | listPlans | GET /plans | List plans |
PlansApi | updateAudience | PUT /plan-audiences/{plan_audience_id} | Update audience |
PlansApi | updatePlan | PUT /plans/{plan_id} | Update plan |
- ApiError
- ApiKeyCreateResponseData
- ApiKeyRequestListResponseData
- ApiKeyRequestResponseData
- ApiKeyResponseData
- AudienceRequestBody
- CheckFlagOutputWithFlagKey
- CheckFlagRequestBody
- CheckFlagResponse
- CheckFlagResponseData
- CheckFlagsResponse
- CheckFlagsResponseData
- CompanyDetailResponseData
- CompanyMembershipDetailResponseData
- CompanyMembershipResponseData
- CompanyOverrideResponseData
- CompanyPlanResponseData
- CompanyResponseData
- CountApiKeysParams
- CountApiKeysResponse
- CountApiRequestsParams
- CountApiRequestsResponse
- CountAudienceCompaniesResponse
- CountAudienceUsersResponse
- CountEventSummariesParams
- CountEventSummariesResponse
- CountEventsParams
- CountEventsResponse
- CountFlagChecksParams
- CountFlagChecksResponse
- CountResponse
- CreateApiKeyRequestBody
- CreateApiKeyResponse
- CreateCompanyOverrideRequestBody
- CreateCompanyOverrideResponse
- CreateCompanyResponse
- CreateEntityTraitDefinitionRequestBody
- CreateEnvironmentRequestBody
- CreateEnvironmentResponse
- CreateEventBatchRequestBody
- CreateEventBatchResponse
- CreateEventRequestBody
- CreateEventResponse
- CreateFeatureRequestBody
- CreateFeatureResponse
- CreateFlagRequestBody
- CreateFlagResponse
- CreateOrUpdateConditionGroupRequestBody
- CreateOrUpdateConditionRequestBody
- CreateOrUpdateFlagRequestBody
- CreateOrUpdateRuleRequestBody
- CreatePlanEntitlementRequestBody
- CreatePlanEntitlementResponse
- CreatePlanRequestBody
- CreatePlanResponse
- CreateReqCommon
- CreateUserResponse
- DeleteApiKeyResponse
- DeleteAudienceResponse
- DeleteCompanyByKeysResponse
- DeleteCompanyMembershipResponse
- DeleteCompanyOverrideResponse
- DeleteCompanyResponse
- DeleteEnvironmentResponse
- DeleteFeatureResponse
- DeleteFlagResponse
- DeletePlanEntitlementResponse
- DeletePlanResponse
- DeleteResponse
- DeleteUserByKeysResponse
- DeleteUserResponse
- EntityKeyResponseData
- EntityTraitDefinitionResponseData
- EnvironmentDetailResponseData
- EnvironmentResponseData
- EventBody
- EventBodyIdentify
- EventBodyIdentifyCompany
- EventBodyTrack
- EventListResponseData
- EventResponseData
- EventSummaryResponseData
- FeatureDetailResponseData
- FeatureResponseData
- FlagCheckLogDetailResponseData
- FlagCheckLogResponseData
- FlagDetailResponseData
- FlagResponseData
- GetApiKeyResponse
- GetApiRequestResponse
- GetCompanyOverrideResponse
- GetCompanyResponse
- GetEnvironmentResponse
- GetEventResponse
- GetEventSummariesParams
- GetEventSummariesResponse
- GetEventSummaryBySubtypeResponse
- GetFeatureResponse
- GetFlagCheckResponse
- GetFlagResponse
- GetLatestFlagChecksParams
- GetLatestFlagChecksResponse
- GetOrCreateCompanyMembershipRequestBody
- GetOrCreateCompanyMembershipResponse
- GetOrCreateEntityTraitDefinitionResponse
- GetPlanEntitlementResponse
- GetPlanResponse
- GetUserResponse
- KeysRequestBody
- ListApiKeysParams
- ListApiKeysResponse
- ListApiRequestsParams
- ListApiRequestsResponse
- ListAudienceCompaniesResponse
- ListAudienceUsersResponse
- ListCompaniesParams
- ListCompaniesResponse
- ListCompanyMembershipsParams
- ListCompanyMembershipsResponse
- ListCompanyOverridesParams
- ListCompanyOverridesResponse
- ListCompanyPlansParams
- ListCompanyPlansResponse
- ListEventsParams
- ListEventsResponse
- ListFeaturesParams
- ListFeaturesResponse
- ListFlagChecksParams
- ListFlagChecksResponse
- ListFlagsParams
- ListFlagsResponse
- ListMetricCountsParams
- ListMetricCountsResponse
- ListPlanEntitlementsParams
- ListPlanEntitlementsResponse
- ListPlansParams
- ListPlansResponse
- ListUsersParams
- ListUsersResponse
- LookupCompanyParams
- LookupCompanyResponse
- LookupUserParams
- LookupUserResponse
- MetricCountsHourlyResponseData
- PaginationFilter
- PlanAudienceDetailResponseData
- PlanAudienceResponseData
- PlanEntitlementResponseData
- PlanResponseData
- RawEventBatchResponseData
- RawEventResponseData
- RuleConditionGroupDetailResponseData
- RuleConditionGroupResponseData
- RuleConditionResponseData
- RuleDetailResponseData
- RuleResponseData
- RulesDetailResponseData
- UpdateApiKeyRequestBody
- UpdateApiKeyResponse
- UpdateAudienceRequestBody
- UpdateAudienceResponse
- UpdateCompanyOverrideRequestBody
- UpdateCompanyOverrideResponse
- UpdateEntityTraitDefinitionRequestBody
- UpdateEntityTraitDefinitionResponse
- UpdateEnvironmentRequestBody
- UpdateEnvironmentResponse
- UpdateFeatureRequestBody
- UpdateFeatureResponse
- UpdateFlagResponse
- UpdateFlagRulesRequestBody
- UpdateFlagRulesResponse
- UpdatePlanEntitlementRequestBody
- UpdatePlanEntitlementResponse
- UpdatePlanRequestBody
- UpdatePlanResponse
- UpdateReqCommon
- UpdateRuleRequestBody
- UpsertCompanyRequestBody
- UpsertCompanyResponse
- UpsertCompanyTraitResponse
- UpsertTraitRequestBody
- UpsertUserRequestBody
- UpsertUserResponse
- UpsertUserSubRequestBody
- UpsertUserTraitResponse
- UserDetailResponseData
- UserResponseData
If you encounter any issues or have questions regarding the Schematic PHP SDK, please contact our support team at support@schematic.com.