Skip to content
EntitlerDocs

POST/v1/customers/{external_id}/grants

Grant a feature to a customer

Gives the customer a feature value for days days, or with no end when days is 0, on top of their plan. Optionally guarded by expectedRevision, with an optional reason. Needs customers:write.

curl -X POST 'https://api.entitler.co/v1/customers/ada/grants' \
  -H "Authorization: Bearer $ENTITLER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"currency":"currency","days":1,"expectedRevision":{"value":1},"featureKey":"featureKey","reason":"reason","target":{"environmentId":"environmentId","projectId":"projectId","teamId":"teamId"},"value":{"limit":{"count":1,"unlimited":{}},"on":{}}}'

Credentials

Send any one of these:

  • Bearer token

Path parameters

NameTypeDescription
external_idrequiredstringThe customer's external ID, or me for the customer a customer token or identity token names.

Request body

object

  • currencystring
  • daysinteger (int64)

    at least 0; at most 4294967295

  • expectedRevisioncommon.Revision-Input
    • valueinteger

      at least 0; at most 18446744073709552000

  • featureKeystring
  • reasonstring
  • targetProductTarget
    • environmentIdstring
    • projectIdstring
    • teamIdstring
  • valueGrantValue
    • limitcommon.Limit
      • countinteger

        at least 0; at most 18446744073709552000

      • unlimitedcommon.Unlimited
    • onSwitchOn

Responses

200The CreateGrantResponse message.

CreateGrantResponse

  • grantGrant
    • featureKeystringrequired
    • fromintegerrequired

      at least 0; at most 18446744073709552000

    • grantedBycommon.Actor
      • idstringrequired
      • typecommon.ActorTyperequired

        One of ACTOR_TYPE_UNSPECIFIED, ACTOR_TYPE_USER, ACTOR_TYPE_KEY, ACTOR_TYPE_SYSTEM.

    • idstringrequired
    • reasonstringrequired
    • revokeReasonstring
    • revokedAtinteger

      at least 0; at most 18446744073709552000

    • revokedBycommon.Actor
      • idstringrequired
      • typecommon.ActorTyperequired

        One of ACTOR_TYPE_UNSPECIFIED, ACTOR_TYPE_USER, ACTOR_TYPE_KEY, ACTOR_TYPE_SYSTEM.

    • untilinteger

      at least 0; at most 18446744073709552000

    • valueGrantValue
      • limitcommon.Limit
        • countinteger

          at least 0; at most 18446744073709552000

        • unlimitedcommon.Unlimited
      • onSwitchOn
  • revisionintegerrequired

    at least 0; at most 18446744073709552000

ErrorA refusal, with the HTTP status of its gRPC code.

Error

  • errorobjectrequired
    • codestringrequired
    • parametersobjectrequired

      Each value: string

    • reasonstringor nullrequired