post-private-tokenfamilies.rst (2279B)
1 .. http:post:: [/instances/$INSTANCES]/private/tokenfamilies 2 3 This is used to create a token family. 4 5 **Required permission:** ``tokenfamilies-write`` 6 7 **Request:** 8 9 The request must be a `TokenFamilyCreateRequest`. 10 11 **Response:** 12 13 :http:statuscode:`204 No content`: 14 The token family was created successfully. 15 16 :http:statuscode:`404 Not found`: 17 The merchant backend is unaware of the instance. 18 19 **Details:** 20 21 .. ts:def:: TokenFamilyCreateRequest 22 23 interface TokenFamilyCreateRequest { 24 25 // Identifier for the token family consisting of unreserved characters 26 // according to RFC 3986. 27 slug: string; 28 29 // Human-readable name for the token family. 30 name: string; 31 32 // Human-readable description for the token family. 33 description: string; 34 35 // Optional map from IETF BCP 47 language tags to localized descriptions. 36 description_i18n?: { [lang_tag: string]: string }; 37 38 // Additional meta data, such as the ``trusted_domains`` 39 // or ``expected_domains``. Depends on the ``kind``. 40 extra_data?: object; 41 42 // Start time of the token family's validity period. 43 // If not specified, merchant backend will use the current time. 44 valid_after?: Timestamp; 45 46 // End time of the token family's validity period. 47 valid_before: Timestamp; 48 49 // Validity duration of an issued token. 50 duration: RelativeTime; 51 52 // Rounding granularity for the start validity of keys. 53 // The desired time is rounded down to a multiple of this 54 // granularity and then the ``start_offset`` is added to 55 // compute the actual start time of the token keys' validity. 56 // The end is then computed by adding the ``duration``. 57 // Must be 1 minute, 1 hour, 1 day, 1 week, 30 days, 90 days 58 // or 365 days (1 year). 59 validity_granularity: RelativeTime; 60 61 // Offset to subtract from the start time rounded to ``validity_granularity`` 62 // to compute the actual start time for a key. 63 // Default is zero. 64 start_offset: RelativeTime; 65 66 // Kind of the token family. 67 kind: TokenFamilyKind; 68 69 } 70 71 .. ts:def:: TokenFamilyKind 72 73 enum TokenFamilyKind { 74 Discount = "discount", 75 Subscription = "subscription", 76 }