github.com/safedep/dry@v0.0.0-20241016050132-a15651f0548b/apiguard/tykgen/docs/KeysApi.md (about)

     1  # {{classname}}
     2  
     3  All URIs are relative to *http://localhost/*
     4  
     5  Method | HTTP request | Description
     6  ------------- | ------------- | -------------
     7  [**AddKey**](KeysApi.md#AddKey) | **Post** /tyk/keys | Create a key
     8  [**CreateCustomKey**](KeysApi.md#CreateCustomKey) | **Post** /tyk/keys/{keyID} | Create Custom Key / Import Key
     9  [**DeleteKey**](KeysApi.md#DeleteKey) | **Delete** /tyk/keys/{keyID} | Delete Key
    10  [**GetKey**](KeysApi.md#GetKey) | **Get** /tyk/keys/{keyID} | Get a Key
    11  [**ListKeys**](KeysApi.md#ListKeys) | **Get** /tyk/keys | List Keys
    12  [**UpdateKey**](KeysApi.md#UpdateKey) | **Put** /tyk/keys/{keyID} | Update Key
    13  
    14  # **AddKey**
    15  > ApiModifyKeySuccess AddKey(ctx, optional)
    16  Create a key
    17  
    18  Tyk will generate the access token based on the OrgID specified in the API Definition and a random UUID. This ensures that keys can be \"owned\" by different API Owners should segmentation be needed at an organisational level. <br/><br/> API keys without access_rights data will be written to all APIs on the system (this also means that they will be created across all SessionHandlers and StorageHandlers, it is recommended to always embed access_rights data in a key to ensure that only targeted APIs and their back-ends are written to.
    19  
    20  ### Required Parameters
    21  
    22  Name | Type | Description  | Notes
    23  ------------- | ------------- | ------------- | -------------
    24   **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
    25   **optional** | ***KeysApiAddKeyOpts** | optional parameters | nil if no parameters
    26  
    27  ### Optional Parameters
    28  Optional parameters are passed through a pointer to a KeysApiAddKeyOpts struct
    29  Name | Type | Description  | Notes
    30  ------------- | ------------- | ------------- | -------------
    31   **body** | [**optional.Interface of SessionState**](SessionState.md)|  | 
    32  
    33  ### Return type
    34  
    35  [**ApiModifyKeySuccess**](apiModifyKeySuccess.md)
    36  
    37  ### Authorization
    38  
    39  [api_key](../README.md#api_key)
    40  
    41  ### HTTP request headers
    42  
    43   - **Content-Type**: application/json
    44   - **Accept**: application/json
    45  
    46  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
    47  
    48  # **CreateCustomKey**
    49  > ApiModifyKeySuccess CreateCustomKey(ctx, keyID, optional)
    50  Create Custom Key / Import Key
    51  
    52  You can use the `POST /tyk/keys/{KEY_ID}` endpoint as defined below to import existing keys into Tyk.  This example uses standard `authorization` header authentication, and assumes that the Gateway is located at `127.0.0.1:8080` and the Tyk secret is `352d20ee67be67f6340b4c0605b044b7` - update these as necessary to match your environment.  To import a key called `mycustomkey`, save the JSON contents as `token.json` (see example below), then run the following Curl command.  ``` curl http://127.0.0.1:8080/tyk/keys/mycustomkey -H 'x-tyk-authorization: 352d20ee67be67f6340b4c0605b044b7' -H 'Content-Type: application/json'  -d @token.json ```  The following request will fail as the key doesn't exist.  ``` curl http://127.0.0.1:8080/quickstart/headers -H 'Authorization. invalid123' ```  But this request will now work, using the imported key.  ``` curl http://127.0.0.1:8080/quickstart/headers -H 'Authorization: mycustomkey' ```  <h4>Example token.json file<h4>  ``` {   \"allowance\": 1000,   \"rate\": 1000,   \"per\": 60,   \"expires\": -1,   \"quota_max\": -1,   \"quota_renews\": 1406121006,   \"quota_remaining\": 0,   \"quota_renewal_rate\": 60,   \"access_rights\": {     \"3\": {       \"api_name\": \"Tyk Test API\",       \"api_id\": \"3\"     }   },   \"org_id\": \"53ac07777cbb8c2d53000002\",   \"basic_auth_data\": {     \"password\": \"\",     \"hash_type\": \"\"   },   \"hmac_enabled\": false,   \"hmac_string\": \"\",   \"is_inactive\": false,   \"apply_policy_id\": \"\",   \"apply_policies\": [     \"59672779fa4387000129507d\",     \"53222349fa4387004324324e\",     \"543534s9fa4387004324324d\"     ],   \"monitor\": {     \"trigger_limits\": []   } } ```
    53  
    54  ### Required Parameters
    55  
    56  Name | Type | Description  | Notes
    57  ------------- | ------------- | ------------- | -------------
    58   **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
    59    **keyID** | **string**| The Key ID | 
    60   **optional** | ***KeysApiCreateCustomKeyOpts** | optional parameters | nil if no parameters
    61  
    62  ### Optional Parameters
    63  Optional parameters are passed through a pointer to a KeysApiCreateCustomKeyOpts struct
    64  Name | Type | Description  | Notes
    65  ------------- | ------------- | ------------- | -------------
    66  
    67   **body** | [**optional.Interface of SessionState**](SessionState.md)|  | 
    68   **hashed** | **optional.**| Use the hash of the key as input instead of the full key | 
    69   **suppressReset** | **optional.**| Adding the suppress_reset parameter and setting it to 1, will cause Tyk not to reset the quota limit that is in the current live quota manager. By default Tyk will reset the quota in the live quota manager (initialising it) when adding a key. Adding the &#x60;suppress_reset&#x60; flag to the URL parameters will avoid this behaviour. | 
    70  
    71  ### Return type
    72  
    73  [**ApiModifyKeySuccess**](apiModifyKeySuccess.md)
    74  
    75  ### Authorization
    76  
    77  [api_key](../README.md#api_key)
    78  
    79  ### HTTP request headers
    80  
    81   - **Content-Type**: application/json
    82   - **Accept**: application/json
    83  
    84  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
    85  
    86  # **DeleteKey**
    87  > ApiStatusMessage DeleteKey(ctx, keyID, optional)
    88  Delete Key
    89  
    90  Deleting a key will remove it permanently from the system, however analytics relating to that key will still be available.
    91  
    92  ### Required Parameters
    93  
    94  Name | Type | Description  | Notes
    95  ------------- | ------------- | ------------- | -------------
    96   **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
    97    **keyID** | **string**| The Key ID | 
    98   **optional** | ***KeysApiDeleteKeyOpts** | optional parameters | nil if no parameters
    99  
   100  ### Optional Parameters
   101  Optional parameters are passed through a pointer to a KeysApiDeleteKeyOpts struct
   102  Name | Type | Description  | Notes
   103  ------------- | ------------- | ------------- | -------------
   104  
   105   **hashed** | **optional.Bool**| Use the hash of the key as input instead of the full key | 
   106  
   107  ### Return type
   108  
   109  [**ApiStatusMessage**](apiStatusMessage.md)
   110  
   111  ### Authorization
   112  
   113  [api_key](../README.md#api_key)
   114  
   115  ### HTTP request headers
   116  
   117   - **Content-Type**: Not defined
   118   - **Accept**: application/json
   119  
   120  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   121  
   122  # **GetKey**
   123  > SessionState GetKey(ctx, keyID, optional)
   124  Get a Key
   125  
   126  Get session info about the specified key. Should return up to date rate limit and quota usage numbers.
   127  
   128  ### Required Parameters
   129  
   130  Name | Type | Description  | Notes
   131  ------------- | ------------- | ------------- | -------------
   132   **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
   133    **keyID** | **string**| The Key ID | 
   134   **optional** | ***KeysApiGetKeyOpts** | optional parameters | nil if no parameters
   135  
   136  ### Optional Parameters
   137  Optional parameters are passed through a pointer to a KeysApiGetKeyOpts struct
   138  Name | Type | Description  | Notes
   139  ------------- | ------------- | ------------- | -------------
   140  
   141   **hashed** | **optional.Bool**| Use the hash of the key as input instead of the full key | 
   142  
   143  ### Return type
   144  
   145  [**SessionState**](SessionState.md)
   146  
   147  ### Authorization
   148  
   149  [api_key](../README.md#api_key)
   150  
   151  ### HTTP request headers
   152  
   153   - **Content-Type**: Not defined
   154   - **Accept**: application/json
   155  
   156  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   157  
   158  # **ListKeys**
   159  > ApiAllKeys ListKeys(ctx, )
   160  List Keys
   161  
   162  You can retrieve all the keys in your Tyk instance. Returns an array of Key IDs.
   163  
   164  ### Required Parameters
   165  This endpoint does not need any parameter.
   166  
   167  ### Return type
   168  
   169  [**ApiAllKeys**](apiAllKeys.md)
   170  
   171  ### Authorization
   172  
   173  [api_key](../README.md#api_key)
   174  
   175  ### HTTP request headers
   176  
   177   - **Content-Type**: Not defined
   178   - **Accept**: application/json
   179  
   180  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   181  
   182  # **UpdateKey**
   183  > ApiModifyKeySuccess UpdateKey(ctx, keyID, optional)
   184  Update Key
   185  
   186  You can also manually add keys to Tyk using your own key-generation algorithm. It is recommended if using this approach to ensure that the OrgID being used in the API Definition and the key data is blank so that Tyk does not try to prepend or manage the key in any way.
   187  
   188  ### Required Parameters
   189  
   190  Name | Type | Description  | Notes
   191  ------------- | ------------- | ------------- | -------------
   192   **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
   193    **keyID** | **string**| The Key ID | 
   194   **optional** | ***KeysApiUpdateKeyOpts** | optional parameters | nil if no parameters
   195  
   196  ### Optional Parameters
   197  Optional parameters are passed through a pointer to a KeysApiUpdateKeyOpts struct
   198  Name | Type | Description  | Notes
   199  ------------- | ------------- | ------------- | -------------
   200  
   201   **body** | [**optional.Interface of SessionState**](SessionState.md)|  | 
   202   **hashed** | **optional.**| Use the hash of the key as input instead of the full key | 
   203   **suppressReset** | **optional.**| Adding the suppress_reset parameter and setting it to 1, will cause Tyk not to reset the quota limit that is in the current live quota manager. By default Tyk will reset the quota in the live quota manager (initialising it) when adding a key. Adding the &#x60;suppress_reset&#x60; flag to the URL parameters will avoid this behaviour. | 
   204  
   205  ### Return type
   206  
   207  [**ApiModifyKeySuccess**](apiModifyKeySuccess.md)
   208  
   209  ### Authorization
   210  
   211  [api_key](../README.md#api_key)
   212  
   213  ### HTTP request headers
   214  
   215   - **Content-Type**: application/json
   216   - **Accept**: application/json
   217  
   218  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   219