# API Reference

## Features enabled

> Use this endpoint to get the list of enabled features for the user. The response will contain the list of features that are enabled for the user.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"publishableKeyInQuery":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"publishableKeyInQuery":{"type":"apiKey","in":"query","name":"publishableKey","description":"Authentication using a publishable API key as a query parameter"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"flagEvaluationContext":{"type":"object","description":"Context object has to be flattened and delimited by dots and provided as query parameters.\nExample:\n```\ncontext.company.id=42&context.user.id=99\n```\n","properties":{"user":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the user"},"company":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the company"}}},"attributes":{"title":"attributes","type":"object","description":"Object consisting of key value pairs\nExample:\n```\n{\n  \"id\": \"u25129\",\n  \"domain\": \"acmeinc.com\",\n  \"plan\": \"enterprise\",\n  \"monthly_spend\": 99,\n  \"createdAt\": \"2024-01-01T10:00:00Z\"\n}\n```\n"},"featureKey":{"type":"string","minLength":1,"maxLength":255,"description":"Feature key - unique identifier of the feature which you can find in app.reflag.com\nExample:\n```\nnew-order-created\n```\n"},"environmentFlagStateVersion":{"type":"number","description":"The version number of the full environment flag state used by `/features` and `waitForVersion`.","minimum":0},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"FeaturesMap":{"description":"A mapping of feature keys to their evaluated states","type":"object","additionalProperties":{"$ref":"#/components/schemas/EvaluatedFeature","title":"FeaturesMap"}},"EvaluatedFeature":{"description":"The result of evaluating a context against a feature","type":"object","required":["key","targetingVersion","isEnabled"],"properties":{"key":{"$ref":"#/components/schemas/featureKey","description":"The unique identifier of the feature"},"targetingVersion":{"$ref":"#/components/schemas/targetingVersion","description":"Version of the targeting rules used in evaluation"},"isEnabled":{"description":"Specifies whether the feature is accessible/enabled","type":"boolean"},"stage":{"type":["string","null"],"description":"The stage of the feature is currently in (e.g. \"Production\", \"Staging\", \"Development\")"},"config":{"description":"The matching configuration for context (optional)","$ref":"#/components/schemas/EvaluatedConfig"},"ruleEvaluationResults":{"type":"array","items":{"type":"boolean"},"description":"The results of evaluation for each of the rules"},"missingContextFields":{"type":"array","items":{"type":"string"},"description":"The fields that were missing in the context for successful evaluation"}}},"targetingVersion":{"type":"number","description":"The version of the targeting rules. Every time when targeting rules are updated the version is incremented.","minimum":0},"EvaluatedConfig":{"description":"The user-defined configuration that matches the evaluated context","type":"object","required":["name","version"],"properties":{"name":{"type":["string","null"],"description":"The name of the matched configuration variant"},"version":{"$ref":"#/components/schemas/featureConfigVersion","description":"The current version of the configuration"},"default":{"type":"boolean","description":"Indicates whether the matched configuration variant is the default one"},"payload":{"$ref":"#/components/schemas/AnyValue","description":"The payload of the configuration variant"},"ruleEvaluationResults":{"type":"array","items":{"type":"boolean"},"description":"The results of evaluation for each of the rules"},"missingContextFields":{"type":"array","items":{"type":"string"},"description":"The fields that were missing in the context for successful evaluation"}}},"featureConfigVersion":{"type":"number","description":"The version of the configuration. Every time feature configuration changes, the version is incremented.","minimum":1},"AnyValue":{"schema":{}},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/features/enabled":{"get":{"summary":"Features enabled","description":"Use this endpoint to get the list of enabled features for the user. The response will contain the list of features that are enabled for the user.\n","parameters":[{"in":"query","name":"context","schema":{"$ref":"#/components/schemas/flagEvaluationContext"}},{"in":"query","name":"key","schema":{"$ref":"#/components/schemas/featureKey"}},{"in":"query","name":"waitForVersion","description":"Waits up to 5 seconds for at least this version of the flag state to be available.\n","schema":{"$ref":"#/components/schemas/environmentFlagStateVersion"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessResponse"},{"type":"object","properties":{"flagStateVersion":{"$ref":"#/components/schemas/environmentFlagStateVersion"},"features":{"$ref":"#/components/schemas/FeaturesMap"},"remoteContextUsed":{"type":"boolean","description":"Indicates if the remote context was used"}},"required":["flagStateVersion","features","remoteContextUsed"]}]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## Features

> Use this endpoint to get the list of all features with their targeting rules.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"secretKey":[]}],"components":{"securitySchemes":{"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"environmentFlagStateVersion":{"type":"number","description":"The version number of the full environment flag state used by `/features` and `waitForVersion`.","minimum":0},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"FeatureWithTargetingAndConfig":{"type":"object","description":"The feature details required for local evaluation","required":["key","targeting"],"properties":{"key":{"description":"The feature key","$ref":"#/components/schemas/featureKey"},"description":{"type":["string","null"],"description":"The description of the feature"},"createdAt":{"type":["string"],"description":"ISO-8601 datetime string when the feature was created"},"link":{"type":["string","null"],"description":"The link to the feature in the Reflag dashboard"},"targeting":{"description":"The targeting rules","$ref":"#/components/schemas/Targeting"},"config":{"description":"The custom user-supplied configuration","$ref":"#/components/schemas/Config"},"stage":{"type":["string","null"],"description":"The name of the stage this feature is currently in (e.g. \"Production\", \"Staging\", \"Development\")"}},"additionalProperties":false},"featureKey":{"type":"string","minLength":1,"maxLength":255,"description":"Feature key - unique identifier of the feature which you can find in app.reflag.com\nExample:\n```\nnew-order-created\n```\n"},"Targeting":{"description":"Contains the targeting configuration for a feature","type":"object","required":["version","rules"],"properties":{"version":{"description":"The version number of this targeting configuration","$ref":"#/components/schemas/targetingVersion"},"rules":{"type":"array","description":"The list of targeting rules. See the schema for Rules","items":{"$ref":"#/components/schemas/TargetingRule"}}},"additionalProperties":false},"targetingVersion":{"type":"number","description":"The version of the targeting rules. Every time when targeting rules are updated the version is incremented.","minimum":0},"TargetingRule":{"description":"A rule that determines if a feature should be enabled based on filters","type":"object","required":["filter"],"properties":{"filter":{"$ref":"#/components/schemas/Filter"}},"additionalProperties":false},"Filter":{"description":"Base type for all filter types used in targeting rules","allOf":[{"type":"object","properties":{"type":{"type":"string","enum":["context","rolloutPercentage","group","negation","constant"]}}},{"oneOf":[{"$ref":"#/components/schemas/FilterGroup"},{"$ref":"#/components/schemas/FilterNegation"},{"$ref":"#/components/schemas/ContextFilter"},{"$ref":"#/components/schemas/RolloutPercentageFilter"},{"$ref":"#/components/schemas/FilterConstant"}]}],"discriminator":{"propertyName":"type","mapping":{"context":"#/components/schemas/ContextFilter","rolloutPercentage":"#/components/schemas/RolloutPercentageFilter","group":"#/components/schemas/FilterGroup","negation":"#/components/schemas/FilterNegation","constant":"#/components/schemas/FilterConstant"}}},"FilterGroup":{"description":"A group of filters combined with a logical operator","type":"object","required":["operator","filters"],"properties":{"operator":{"type":"string","enum":["and","or"]},"filters":{"type":"array","items":{"$ref":"#/components/schemas/Filter"}}},"additionalProperties":false},"FilterNegation":{"description":"Negates/inverts the result of the contained filter","type":"object","required":["filter"],"properties":{"filter":{"$ref":"#/components/schemas/Filter"}},"additionalProperties":false},"ContextFilter":{"description":"A filter that evaluates context fields against specified conditions","type":"object","required":["operator","field","values"],"properties":{"operator":{"type":"string","enum":["IS","IS_NOT","ANY_OF","NOT_ANY_OF","CONTAINS","NOT_CONTAINS","GT","LT","AFTER","BEFORE","DATE_AFTER","DATE_BEFORE","SET","NOT_SET","IS_TRUE","IS_FALSE"]},"field":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}},"additionalProperties":false},"RolloutPercentageFilter":{"description":"A filter that enables gradual feature rollout based on company ID","type":"object","required":["partialRolloutAttribute","partialRolloutThreshold"],"properties":{"partialRolloutAttribute":{"type":"string","enum":["company.id"]},"partialRolloutThreshold":{"type":"number"}},"additionalProperties":false},"FilterConstant":{"description":"A filter that always returns a constant boolean value","type":"object","required":["value"],"properties":{"value":{"type":"boolean"}},"additionalProperties":false},"Config":{"type":"object","required":["version","variants"],"properties":{"version":{"description":"Current version number of the entire configuration","$ref":"#/components/schemas/featureConfigVersion"},"variants":{"description":"List of possible configuration variants with their targeting rules","type":"array","items":{"$ref":"#/components/schemas/ConfigVariant"}}},"additionalProperties":false},"featureConfigVersion":{"type":"number","description":"The version of the configuration. Every time feature configuration changes, the version is incremented.","minimum":1},"ConfigVariant":{"type":"object","description":"A variant of configuration including the rules that need to be matched","required":["name","default","filter"],"properties":{"name":{"type":["string","null"],"description":"The name of the configuration variant"},"default":{"type":"boolean","description":"Specifies whether the variant is the default one"},"payload":{"$ref":"#/components/schemas/AnyValue","description":"The payload of the variant (the actual user-configured value in Reflag)"},"filter":{"$ref":"#/components/schemas/Filter"}},"additionalProperties":false},"AnyValue":{"schema":{}},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/features":{"get":{"summary":"Features","description":"Use this endpoint to get the list of all features with their targeting rules.\n","parameters":[{"in":"query","name":"waitForVersion","description":"Waits up to 5 seconds for at least this version of the flag state to be available.\n","schema":{"$ref":"#/components/schemas/environmentFlagStateVersion"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessResponse"},{"type":"object","required":["flagStateVersion","features"],"properties":{"flagStateVersion":{"$ref":"#/components/schemas/environmentFlagStateVersion"},"features":{"type":"array","items":{"$ref":"#/components/schemas/FeatureWithTargetingAndConfig"}}}}]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## Features evaluated

> Use this endpoint to get the list of all features evaluated for the user.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"publishableKeyInQuery":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"publishableKeyInQuery":{"type":"apiKey","in":"query","name":"publishableKey","description":"Authentication using a publishable API key as a query parameter"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"flagEvaluationContext":{"type":"object","description":"Context object has to be flattened and delimited by dots and provided as query parameters.\nExample:\n```\ncontext.company.id=42&context.user.id=99\n```\n","properties":{"user":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the user"},"company":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the company"}}},"attributes":{"title":"attributes","type":"object","description":"Object consisting of key value pairs\nExample:\n```\n{\n  \"id\": \"u25129\",\n  \"domain\": \"acmeinc.com\",\n  \"plan\": \"enterprise\",\n  \"monthly_spend\": 99,\n  \"createdAt\": \"2024-01-01T10:00:00Z\"\n}\n```\n"},"featureKey":{"type":"string","minLength":1,"maxLength":255,"description":"Feature key - unique identifier of the feature which you can find in app.reflag.com\nExample:\n```\nnew-order-created\n```\n"},"environmentFlagStateVersion":{"type":"number","description":"The version number of the full environment flag state used by `/features` and `waitForVersion`.","minimum":0},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"FeaturesMap":{"description":"A mapping of feature keys to their evaluated states","type":"object","additionalProperties":{"$ref":"#/components/schemas/EvaluatedFeature","title":"FeaturesMap"}},"EvaluatedFeature":{"description":"The result of evaluating a context against a feature","type":"object","required":["key","targetingVersion","isEnabled"],"properties":{"key":{"$ref":"#/components/schemas/featureKey","description":"The unique identifier of the feature"},"targetingVersion":{"$ref":"#/components/schemas/targetingVersion","description":"Version of the targeting rules used in evaluation"},"isEnabled":{"description":"Specifies whether the feature is accessible/enabled","type":"boolean"},"stage":{"type":["string","null"],"description":"The stage of the feature is currently in (e.g. \"Production\", \"Staging\", \"Development\")"},"config":{"description":"The matching configuration for context (optional)","$ref":"#/components/schemas/EvaluatedConfig"},"ruleEvaluationResults":{"type":"array","items":{"type":"boolean"},"description":"The results of evaluation for each of the rules"},"missingContextFields":{"type":"array","items":{"type":"string"},"description":"The fields that were missing in the context for successful evaluation"}}},"targetingVersion":{"type":"number","description":"The version of the targeting rules. Every time when targeting rules are updated the version is incremented.","minimum":0},"EvaluatedConfig":{"description":"The user-defined configuration that matches the evaluated context","type":"object","required":["name","version"],"properties":{"name":{"type":["string","null"],"description":"The name of the matched configuration variant"},"version":{"$ref":"#/components/schemas/featureConfigVersion","description":"The current version of the configuration"},"default":{"type":"boolean","description":"Indicates whether the matched configuration variant is the default one"},"payload":{"$ref":"#/components/schemas/AnyValue","description":"The payload of the configuration variant"},"ruleEvaluationResults":{"type":"array","items":{"type":"boolean"},"description":"The results of evaluation for each of the rules"},"missingContextFields":{"type":"array","items":{"type":"string"},"description":"The fields that were missing in the context for successful evaluation"}}},"featureConfigVersion":{"type":"number","description":"The version of the configuration. Every time feature configuration changes, the version is incremented.","minimum":1},"AnyValue":{"schema":{}},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/features/evaluated":{"get":{"summary":"Features evaluated","description":"Use this endpoint to get the list of all features evaluated for the user.\n","parameters":[{"in":"query","name":"context","schema":{"$ref":"#/components/schemas/flagEvaluationContext"}},{"in":"query","name":"key","schema":{"$ref":"#/components/schemas/featureKey"}},{"in":"query","name":"waitForVersion","description":"Waits up to 5 seconds for at least this version of the flag state to be available.\n","schema":{"$ref":"#/components/schemas/environmentFlagStateVersion"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessResponse"},{"type":"object","properties":{"flagStateVersion":{"$ref":"#/components/schemas/environmentFlagStateVersion"},"features":{"$ref":"#/components/schemas/FeaturesMap"},"remoteContextUsed":{"type":"boolean","description":"Indicates if the remote context was used"}},"required":["flagStateVersion","features","remoteContextUsed"]}]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## Features events

> Use this endpoint to send feature events to Reflag.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"FeatureEvent":{"title":"Feature Event","description":"Represents an event related to feature flag evaluation","type":"object","required":["action","key","evalResult"],"properties":{"action":{"type":"string","enum":["check-is-enabled","check-config"]},"key":{"$ref":"#/components/schemas/featureKey"},"targetingVersion":{"$ref":"#/components/schemas/targetingVersion"},"evalContext":{"$ref":"#/components/schemas/flagEvaluationContext"},"evalResult":{"type":"boolean","description":"The result of the evaluation"},"evalRuleResults":{"type":"array","items":{"type":"boolean"},"description":"The results of evaluation for each of the rules"},"evalMissingFields":{"type":"array","items":{"type":"string"},"description":"The fields that were missing in the context for successful evaluation"}},"additionalProperties":false},"featureKey":{"type":"string","minLength":1,"maxLength":255,"description":"Feature key - unique identifier of the feature which you can find in app.reflag.com\nExample:\n```\nnew-order-created\n```\n"},"targetingVersion":{"type":"number","description":"The version of the targeting rules. Every time when targeting rules are updated the version is incremented.","minimum":0},"flagEvaluationContext":{"type":"object","description":"Context object has to be flattened and delimited by dots and provided as query parameters.\nExample:\n```\ncontext.company.id=42&context.user.id=99\n```\n","properties":{"user":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the user"},"company":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the company"}}},"attributes":{"title":"attributes","type":"object","description":"Object consisting of key value pairs\nExample:\n```\n{\n  \"id\": \"u25129\",\n  \"domain\": \"acmeinc.com\",\n  \"plan\": \"enterprise\",\n  \"monthly_spend\": 99,\n  \"createdAt\": \"2024-01-01T10:00:00Z\"\n}\n```\n"},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/features/events":{"post":{"summary":"Features events","description":"Use this endpoint to send feature events to Reflag.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FeatureEvent"}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## User

> Use this endpoint when you want to send user attributes to Reflag. If the user does not exist, it will be created. This endpoint is also used whenever you construct Reflag client in any of the SDKs.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"publishableKeyInQuery":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"publishableKeyInQuery":{"type":"apiKey","in":"query","name":"publishableKey","description":"Authentication using a publishable API key as a query parameter"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"User":{"title":"User","description":"Represents a user entity with their attributes and metadata","type":"object","properties":{"userId":{"$ref":"#/components/schemas/userId","description":"Unique identifier for the user"},"attributes":{"$ref":"#/components/schemas/attributes","description":"Additional attributes of the user"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"Timestamp associated with the user data"}},"required":["userId"],"additionalProperties":false},"userId":{"type":"string","minLength":1,"description":"Unique identifier for a user in the system"},"attributes":{"title":"attributes","type":"object","description":"Object consisting of key value pairs\nExample:\n```\n{\n  \"id\": \"u25129\",\n  \"domain\": \"acmeinc.com\",\n  \"plan\": \"enterprise\",\n  \"monthly_spend\": 99,\n  \"createdAt\": \"2024-01-01T10:00:00Z\"\n}\n```\n"},"timestamp":{"type":"string","format":"date-time","description":"Number (milliseconds since epoch) or an ISO-8601 datetime string\nExample: \n```\n2021-01-01T13:37:00.000Z\n```\nDefaults to current time if not provided\n"},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/user":{"post":{"summary":"User","description":"Use this endpoint when you want to send user attributes to Reflag. If the user does not exist, it will be created. This endpoint is also used whenever you construct Reflag client in any of the SDKs.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## Company

> Use this endpoint when you want to send company attributes to Reflag. If the company does not exist, it will be created. You can also use this endpoint to assign user to a company by including the user ID. This endpoint is also used whenever you construct Reflag client in any of the SDKs.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"publishableKeyInQuery":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"publishableKeyInQuery":{"type":"apiKey","in":"query","name":"publishableKey","description":"Authentication using a publishable API key as a query parameter"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"Company":{"title":"Company","description":"Represents a company entity with its attributes and associated user","type":"object","properties":{"userId":{"$ref":"#/components/schemas/userId","description":"Identifier for the user linked to the company"},"companyId":{"$ref":"#/components/schemas/companyId","description":"Unique identifier for the company"},"attributes":{"$ref":"#/components/schemas/attributes","description":"Additional attributes of the company"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"Timestamp associated with the company data"}},"required":["companyId"],"additionalProperties":false},"userId":{"type":"string","minLength":1,"description":"Unique identifier for a user in the system"},"companyId":{"type":"string","minLength":1,"description":"Unique identifier for a company in the system"},"attributes":{"title":"attributes","type":"object","description":"Object consisting of key value pairs\nExample:\n```\n{\n  \"id\": \"u25129\",\n  \"domain\": \"acmeinc.com\",\n  \"plan\": \"enterprise\",\n  \"monthly_spend\": 99,\n  \"createdAt\": \"2024-01-01T10:00:00Z\"\n}\n```\n"},"timestamp":{"type":"string","format":"date-time","description":"Number (milliseconds since epoch) or an ISO-8601 datetime string\nExample: \n```\n2021-01-01T13:37:00.000Z\n```\nDefaults to current time if not provided\n"},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/company":{"post":{"summary":"Company","description":"Use this endpoint when you want to send company attributes to Reflag. If the company does not exist, it will be created. You can also use this endpoint to assign user to a company by including the user ID. This endpoint is also used whenever you construct Reflag client in any of the SDKs.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Company"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## Event

> Use this endpoint when you want to send a tracking events to Reflag.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"publishableKeyInQuery":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"publishableKeyInQuery":{"type":"apiKey","in":"query","name":"publishableKey","description":"Authentication using a publishable API key as a query parameter"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"Event":{"title":"Event","description":"Represents a tracking event with associated user, company, and metadata","type":"object","properties":{"userId":{"$ref":"#/components/schemas/userId","description":"Identifier for the user initiating the event"},"event":{"type":"string","minLength":1,"description":"The name of the generated event"},"attributes":{"$ref":"#/components/schemas/attributes","description":"Additional event-related attributes"},"companyId":{"$ref":"#/components/schemas/companyId","description":"Identifier for the company linked to the event"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"Timestamp associated with the event"}},"required":["userId","event"]},"userId":{"type":"string","minLength":1,"description":"Unique identifier for a user in the system"},"attributes":{"title":"attributes","type":"object","description":"Object consisting of key value pairs\nExample:\n```\n{\n  \"id\": \"u25129\",\n  \"domain\": \"acmeinc.com\",\n  \"plan\": \"enterprise\",\n  \"monthly_spend\": 99,\n  \"createdAt\": \"2024-01-01T10:00:00Z\"\n}\n```\n"},"companyId":{"type":"string","minLength":1,"description":"Unique identifier for a company in the system"},"timestamp":{"type":"string","format":"date-time","description":"Number (milliseconds since epoch) or an ISO-8601 datetime string\nExample: \n```\n2021-01-01T13:37:00.000Z\n```\nDefaults to current time if not provided\n"},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/event":{"post":{"summary":"Event","description":"Use this endpoint when you want to send a tracking events to Reflag.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## Feedback

> Use this endpoint when you want to send feedback events to Reflag.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"publishableKeyInQuery":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"publishableKeyInQuery":{"type":"apiKey","in":"query","name":"publishableKey","description":"Authentication using a publishable API key as a query parameter"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"Feedback":{"title":"Feedback","description":"Represents user feedback data with associated context and metadata","type":"object","properties":{"feedbackId":{"type":"string","minLength":1,"description":"Unique identifier for updating existing feedback"},"userId":{"$ref":"#/components/schemas/userId","description":"Identifier of the user providing feedback"},"companyId":{"$ref":"#/components/schemas/companyId","description":"Identifier of the company linked to the feedback"},"promptId":{"type":"string","minLength":10,"maxLength":40,"description":"Identifier of the feedback prompt"},"featureId":{"type":"string","minLength":1,"maxLength":14,"description":"Identifier of the feature the feedback is related to"},"key":{"$ref":"#/components/schemas/featureKey"},"question":{"type":"string","minLength":1,"maxLength":256,"description":"In case the feedback is initiated by a prompt this will be the question which was asked"},"promptedQuestion":{"type":"string","minLength":1,"maxLength":256,"description":"In case the feedback is initiated by a prompt this will be the question which was asked"},"source":{"type":"string","enum":["api","manual","prompt","sdk","widget"],"description":"The source of the feedback"},"score":{"type":"number","minimum":0,"maximum":5,"description":"The score of the feedback"},"comment":{"type":"string","minLength":1,"maxLength":4000,"description":"The user's input"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"When the feedback was submitted"}},"required":["userId"]},"userId":{"type":"string","minLength":1,"description":"Unique identifier for a user in the system"},"companyId":{"type":"string","minLength":1,"description":"Unique identifier for a company in the system"},"featureKey":{"type":"string","minLength":1,"maxLength":255,"description":"Feature key - unique identifier of the feature which you can find in app.reflag.com\nExample:\n```\nnew-order-created\n```\n"},"timestamp":{"type":"string","format":"date-time","description":"Number (milliseconds since epoch) or an ISO-8601 datetime string\nExample: \n```\n2021-01-01T13:37:00.000Z\n```\nDefaults to current time if not provided\n"},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/feedback":{"post":{"summary":"Feedback","description":"Use this endpoint when you want to send feedback events to Reflag.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Feedback"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

## Bulk

> Use this endpoint when you want to send multiple events to Reflag.<br>

````json
{"openapi":"3.1.0","info":{"title":"Reflag Public API","version":"1.0.0"},"servers":[{"url":"https://front.reflag.com","description":"Globally distributed API"},{"url":"https://front-eu.reflag.com","description":"API to be accessed by customers using EU data residency"}],"security":[{"publishableKey":[]},{"publishableKeyInQuery":[]},{"secretKey":[]}],"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Set the Authorization header to:\n```http\n  Authorization: Bearer <publishable_key>\n```\n"},"publishableKeyInQuery":{"type":"apiKey","in":"query","name":"publishableKey","description":"Authentication using a publishable API key as a query parameter"},"secretKey":{"type":"http","scheme":"bearer","description":"Set the `Authorization` header to:\n```http\nAuthorization: Bearer <secret_key>\n```\n"}},"schemas":{"Bulk":{"description":"A collection of different types of operations to be processed in bulk","title":"Bulk","type":"array","items":{"$ref":"#/components/schemas/BulkItem"}},"BulkItem":{"description":"A single item in a bulk operation request that can be of different types","allOf":[{"type":"object","properties":{"type":{"type":"string","enum":["user","company","event","feedback"]}},"required":["type"]},{"oneOf":[{"$ref":"#/components/schemas/User"},{"$ref":"#/components/schemas/Company"},{"$ref":"#/components/schemas/Event"},{"$ref":"#/components/schemas/Feedback"},{"$ref":"#/components/schemas/FeatureEvent"}]}],"discriminator":{"propertyName":"type","mapping":{"user":"#/components/schemas/User","company":"#/components/schemas/Company","event":"#/components/schemas/Event","feedback":"#/components/schemas/Feedback","feature-flag-event":"#/components/schemas/FeatureEvent"}}},"User":{"title":"User","description":"Represents a user entity with their attributes and metadata","type":"object","properties":{"userId":{"$ref":"#/components/schemas/userId","description":"Unique identifier for the user"},"attributes":{"$ref":"#/components/schemas/attributes","description":"Additional attributes of the user"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"Timestamp associated with the user data"}},"required":["userId"],"additionalProperties":false},"userId":{"type":"string","minLength":1,"description":"Unique identifier for a user in the system"},"attributes":{"title":"attributes","type":"object","description":"Object consisting of key value pairs\nExample:\n```\n{\n  \"id\": \"u25129\",\n  \"domain\": \"acmeinc.com\",\n  \"plan\": \"enterprise\",\n  \"monthly_spend\": 99,\n  \"createdAt\": \"2024-01-01T10:00:00Z\"\n}\n```\n"},"timestamp":{"type":"string","format":"date-time","description":"Number (milliseconds since epoch) or an ISO-8601 datetime string\nExample: \n```\n2021-01-01T13:37:00.000Z\n```\nDefaults to current time if not provided\n"},"Company":{"title":"Company","description":"Represents a company entity with its attributes and associated user","type":"object","properties":{"userId":{"$ref":"#/components/schemas/userId","description":"Identifier for the user linked to the company"},"companyId":{"$ref":"#/components/schemas/companyId","description":"Unique identifier for the company"},"attributes":{"$ref":"#/components/schemas/attributes","description":"Additional attributes of the company"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"Timestamp associated with the company data"}},"required":["companyId"],"additionalProperties":false},"companyId":{"type":"string","minLength":1,"description":"Unique identifier for a company in the system"},"Event":{"title":"Event","description":"Represents a tracking event with associated user, company, and metadata","type":"object","properties":{"userId":{"$ref":"#/components/schemas/userId","description":"Identifier for the user initiating the event"},"event":{"type":"string","minLength":1,"description":"The name of the generated event"},"attributes":{"$ref":"#/components/schemas/attributes","description":"Additional event-related attributes"},"companyId":{"$ref":"#/components/schemas/companyId","description":"Identifier for the company linked to the event"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"Timestamp associated with the event"}},"required":["userId","event"]},"Feedback":{"title":"Feedback","description":"Represents user feedback data with associated context and metadata","type":"object","properties":{"feedbackId":{"type":"string","minLength":1,"description":"Unique identifier for updating existing feedback"},"userId":{"$ref":"#/components/schemas/userId","description":"Identifier of the user providing feedback"},"companyId":{"$ref":"#/components/schemas/companyId","description":"Identifier of the company linked to the feedback"},"promptId":{"type":"string","minLength":10,"maxLength":40,"description":"Identifier of the feedback prompt"},"featureId":{"type":"string","minLength":1,"maxLength":14,"description":"Identifier of the feature the feedback is related to"},"key":{"$ref":"#/components/schemas/featureKey"},"question":{"type":"string","minLength":1,"maxLength":256,"description":"In case the feedback is initiated by a prompt this will be the question which was asked"},"promptedQuestion":{"type":"string","minLength":1,"maxLength":256,"description":"In case the feedback is initiated by a prompt this will be the question which was asked"},"source":{"type":"string","enum":["api","manual","prompt","sdk","widget"],"description":"The source of the feedback"},"score":{"type":"number","minimum":0,"maximum":5,"description":"The score of the feedback"},"comment":{"type":"string","minLength":1,"maxLength":4000,"description":"The user's input"},"timestamp":{"$ref":"#/components/schemas/timestamp","description":"When the feedback was submitted"}},"required":["userId"]},"featureKey":{"type":"string","minLength":1,"maxLength":255,"description":"Feature key - unique identifier of the feature which you can find in app.reflag.com\nExample:\n```\nnew-order-created\n```\n"},"FeatureEvent":{"title":"Feature Event","description":"Represents an event related to feature flag evaluation","type":"object","required":["action","key","evalResult"],"properties":{"action":{"type":"string","enum":["check-is-enabled","check-config"]},"key":{"$ref":"#/components/schemas/featureKey"},"targetingVersion":{"$ref":"#/components/schemas/targetingVersion"},"evalContext":{"$ref":"#/components/schemas/flagEvaluationContext"},"evalResult":{"type":"boolean","description":"The result of the evaluation"},"evalRuleResults":{"type":"array","items":{"type":"boolean"},"description":"The results of evaluation for each of the rules"},"evalMissingFields":{"type":"array","items":{"type":"string"},"description":"The fields that were missing in the context for successful evaluation"}},"additionalProperties":false},"targetingVersion":{"type":"number","description":"The version of the targeting rules. Every time when targeting rules are updated the version is incremented.","minimum":0},"flagEvaluationContext":{"type":"object","description":"Context object has to be flattened and delimited by dots and provided as query parameters.\nExample:\n```\ncontext.company.id=42&context.user.id=99\n```\n","properties":{"user":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the user"},"company":{"$ref":"#/components/schemas/attributes","description":"Attributes associated with the company"}}},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[true]}},"required":["success"],"description":"Standard response format for successful API calls"},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the request was successful","enum":[false],"default":false},"error":{"type":"object","properties":{"code":{"type":"string","enum":["UNKNOWN_ERROR","INVALID_API_KEY","FEEDBACK_PROMPTING_DISABLED","BODY_VALIDATION_FAILED","QUERY_VALIDATION_FAILED","SEGMENT_AUTH_REQUIRED","SEGMENT_MESSAGE_TYPE_NOT_SUPPORTED","SEGMENT_MESSAGE_VALIDATION_FAILED","FEATURE_NOT_FOUND","WRONG_REGION"],"description":"The error code"},"message":{"type":"string","description":"The error message"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"The error message"}}}}}}},"required":["error","success"],"additionalProperties":false,"description":"Standard response format for failed API calls"}}},"paths":{"/bulk":{"post":{"summary":"Bulk","description":"Use this endpoint when you want to send multiple events to Reflag.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bulk"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
````

#### Rules schema

| Attribute | Type   | Description                                                                                                                                          |
| --------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| filter    | Filter | Object containing filtering rules which will evaluate against context object. Filter can be an instance of 5 different filter types described below. |

#### Filter Schema

{% tabs %}
{% tab title="Group" %}

| Attribute    | Type              | Desription                                                                                  |
| ------------ | ----------------- | ------------------------------------------------------------------------------------------- |
| type         | `group`           | Filter group will evaluate by applying a logical operation to the array of filters provided |
| filters      | Filter\[]         | Array of filters                                                                            |
| operator     | enum(`and`, `or`) | Logical operation                                                                           |
| {% endtab %} |                   |                                                                                             |

{% tab title="Negation" %}

| Attribute    | Type       | Desription                                                                         |
| ------------ | ---------- | ---------------------------------------------------------------------------------- |
| type         | `negation` | Negation filter is used to negate the evaluation result of the underlying filters. |
| filter       | Filter     | Filter object to be negated                                                        |
| {% endtab %} |            |                                                                                    |

{% tab title="Context" %}

| Attribute    | Type                                                                                                                                    | Desription                                                                                                                                                                                                                                      |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type         | `context`                                                                                                                               |                                                                                                                                                                                                                                                 |
| field        | string                                                                                                                                  | <p>Refers to a field of the context object.<br>Example: company.tier</p>                                                                                                                                                                        |
| values       | string\[]                                                                                                                               | Array of values which will be compared with the value of the context field. Operators SET, NOT\_SET, IS\_TRUE, IS\_FALSE require 0 values, ANY\_OF and NOT\_ANY\_OF support multiple values. All the other operators require exactly one value. |
| operator     | enum(`IS`,`IS_NOT`,`ANY_OF`,`NOT_ANY_OF`,`CONTAINS`,`NOT_CONTAINS`","`GT`" ,`LT`,`AFTER`,`BEFORE`,`SET`,`NOT_SET`,`IS_TRUE`,`IS_FALSE`) | Operator for comparison of the context field with provided values.                                                                                                                                                                              |
| {% endtab %} |                                                                                                                                         |                                                                                                                                                                                                                                                 |

{% tab title="Rollout Percentage" %}

| Attribute               | Type                | Desription                                                                                                                                                                                                                                                                                                        |
| ----------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type                    | `rolloutPercentage` | Rollout percentage filter is used for gradual rollouts. It evaluates to true or false proportionally based on the rollout threshold provided. Reflag evaluates the filter by calculating a numeric hash from the rollout attribute. Contexts of which hash is under the threshold provided will evaluate to true. |
| partialRolloutAttribute | `company.id`        | Currently only "company.id" is supported.                                                                                                                                                                                                                                                                         |
| partialRolloutThreshold | number              | Number from 0 to 10000 where 0 means no one will have access and 10000 means everyone will have access.                                                                                                                                                                                                           |
| {% endtab %}            |                     |                                                                                                                                                                                                                                                                                                                   |

{% tab title="Constant" %}

| Attribute     | Type       | Desription                                                                                                                       |
| ------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- |
| type          | `constant` | Filter constant will evaluate to the value provided. This is expected when the feature is enabled either for everyone or no one. |
| value         | boolean    | Value to which the filter should evaluate                                                                                        |
| {% endtab %}  |            |                                                                                                                                  |
| {% endtabs %} |            |                                                                                                                                  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.reflag.com/api/public-api/public-api-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
