К содержанию
TelegaFirst

Для AI-агентов: markdown этой страницы — /docs/api-op-setsiteaccessrule.mdиндекс документации — /llms.txt

setSiteAccessRule

Обновлено

PUT /api/v1/tools/site/access-rules

Open a page or a block of a page only to part of the audience

Авторизация и права

Scopes: ALL. Auth alternatives: OR; scopes внутри альтернативы: ALL.

ПолеЗначение
security.0.hubApiKey[]
security.1.hubBearer[]
securitySchemes.hubApiKey.in"header"
securitySchemes.hubApiKey.name"X-Api-Key"
securitySchemes.hubApiKey.type"apiKey"
securitySchemes.hubBearer.scheme"bearer"
securitySchemes.hubBearer.type"http"
x-required-scopes["site:write"]

Параметры запроса

ПолеЗначение
0.description"Tenant, credential and handler-bound byte-shape replay key"
0.in"header"
0.name"Idempotency-Key"
0.requiredfalse
0.schema0.schema

Тело запроса

ПолеЗначение
content.application/json.schemaSiteAccessRuleRequest
requiredtrue

Ответы

ПолеЗначение
200.content.application/json.schemaSiteAccessRuleSetResult
200.description"Tenant site control-plane result"
200.headers.X-Bot-Username.description"Active bot username, when resolved"
200.headers.X-Bot-Username.schema200.headers.X-Bot-Username.schema
200.headers.X-Client-Slug.description"Active tenant slug, when resolved"
200.headers.X-Client-Slug.schema200.headers.X-Client-Slug.schema
200.headers.X-RateLimit-Limit.description"Effective request budget"
200.headers.X-RateLimit-Limit.schema200.headers.X-RateLimit-Limit.schema
200.headers.X-RateLimit-Remaining.description"Remaining request budget"
200.headers.X-RateLimit-Remaining.schema200.headers.X-RateLimit-Remaining.schema
200.headers.X-RateLimit-Reset.description"Unix window reset in seconds"
200.headers.X-RateLimit-Reset.schema200.headers.X-RateLimit-Reset.schema

Ошибки

ПолеЗначение
400.content.application/problem+json.schemaProblemDetails
400.description"Invalid strict body"
400.x-error-codes["VALIDATION_ERROR"]
401.content.application/problem+json.schemaProblemDetails
401.description"Missing, invalid, revoked or conflicting credential; surface JWT is refused"
401.x-error-codes["INVALID_API_KEY"]
403.content.application/problem+json.schemaProblemDetails
403.description"Missing scope, prohibited publishable credential or absent active bot"
403.x-error-codes["INSUFFICIENT_SCOPE","PUBLISHABLE_KEY_NOT_ALLOWED","NO_ACTIVE_BOT"]
409.content.application/problem+json.schemaProblemDetails
409.description"Typed domain conflict or request in flight"
409.x-error-codes["CONFLICT"]
413.content.application/problem+json.schemaProblemDetails
413.description"Resource policy size or item-count limit exceeded"
413.x-error-codes["PAYLOAD_TOO_LARGE","ITEM_COUNT_EXCEEDED"]
422.content.application/problem+json.schemaProblemDetails
422.description"Replay key reused for different input; the rule is malformed; no such catalog item, saved segment or password, or the item is not sold as a subscription; the business has no connected public channel; the segment filter is invalid; the sign-in page is itself closed or there is no password to sign in with; the business is at its limit of rules"
422.x-error-codes["IDEMPOTENCY_KEY_MISMATCH","SITE_ACCESS_RULE_INVALID","SITE_ACCESS_CATALOG_NOT_FOUND","SITE_ACCESS_CATALOG_NOT_SUBSCRIPTION","SITE_ACCESS_CHANNEL_NOT_CONNECTED","SITE_ACCESS_SAVED_SEGMENT_NOT_FOUND","SITE_ACCESS_SEGMENT_INVALID","SITE_ACCESS_RULE_LIMIT","SITE_PASSWORD_NOT_FOUND","SITE_ACCESS_LOGIN_PATH_GATED","SITE_ACCESS_LOGIN_PATH_WITHOUT_PASSWORD"]
429.content.application/problem+json.schemaProblemDetails
429.description"Resource rate budget exceeded or unavailable"
429.headers.Retry-After.description"Retry delay in seconds, when supplied by the limiter"
429.headers.Retry-After.schema429.headers.Retry-After.schema
429.x-error-codes["RATE_LIMIT_EXCEEDED","RATE_LIMIT_UNAVAILABLE"]
500.content.application/problem+json.schemaProblemDetails
500.description"Unexpected internal failure"
500.x-error-codes["INTERNAL_ERROR"]

Дополнительные условия

ПолеЗначение
description"Owner-only site:write. One rule per target: path (a mask of the path the page is served at, such as /pricing.html, /lessons/ or /lessons/*, * only last; /pricing does not match pricing.html) plus an optional block (a name of letters, digits and hyphens; the block is the bundle file __telegafirst/blocks/{block}.html and the page holds only a data-tgf-block placeholder). Setting a target again updates its rule. any_of (1 to 10 conditions) is who gets in, and one of the conditions is enough: a product (catalog_id, a 0-price product counts), a live subscription ({\"kind\":\"subscription\"}: any paid one, a trial and a 0-price subscription do not count; with catalog_id: to that subscription item, a trial and a 0-price one count, and a cancelled one counts until its paid period ends), the business public channel, any signed-in customer of this business ({\"kind\":\"signed_in\"}), a saved segment (saved_segment_id), an inline segment filter, or a password by its name ({\"kind\":\"password\",\"password\":\"acme\"}, made with PUT /api/v1/tools/site/passwords). Where several masks match a path, the most specific mask decides and overrides the general one (/kp/acme/* over /kp/*); a block follows the most specific mask of its page. The platform keeps passwords. Never put a password in HTML or JS. The default sign-in page is ready; an own page is login_path (open: outside every closed mask) plus /widget/gate.v1.js. Data for the admitted is a JSON file under the closed mask; a third-party API key is a site secret. mode is hide (default, the block is absent) or lock (a stub with the condition); without a block the whole page is closed and a visitor who fails goes to sign-in. is_active false pauses the rule. Effective at once, no republish, and a republish keeps it; unprojected_hosts above 0 counts hosts whose edge catches up on the next reconciliation. At most 200 rules per business, paused ones included. Idempotency-Key is optional for PUT."
operationId"setSiteAccessRule"
summary"Open a page or a block of a page only to part of the audience"
tags["site"]
x-idempotency.conflictStatus422
x-idempotency.implementation"global-cache"
x-idempotency.replayStatus200
x-idempotency.requiredfalse
x-idempotency.scope["client","credential","controller-handler","key"]
x-idempotency.ttlSeconds86400
x-pagination.queryParameters[]
x-pagination.supportedfalse
x-scope-semantics"ALL"