Skip to content

Time API Endpoint

Use this endpoint to get current UTC time.

Time

Get current UTC time.

/v1/svc/time Try it Out


Requests

1. Check Time.

Get current UTC time.

Request Body
type required default desc
idStringfalse
utctimeStringtrue
apiuserStringtrue
typeinttrue990990 - Current UTC Time
bodyStringtrue'{ }'Json Request body
Example
'{ 
 "id":< Your own reference >,
 "utctime": <UTC Timestamp>,
 "apiUser":< Your Api User ID >,
 "type":990,
 "body":'{}'
}'
Sample Code
    curl -X POST "https://api.gridy.io/v1/svc/time" 
        -H  "accept: application/json; charset=utf-8" 
        -H  "Authorization: gridy-hmac: apiuser=000000000,signedheaders=x-gridy-utctime;x-gridy-cnonce,algorithm=gridy-hmac512,signature=e0025d840dc5368028a90a9e73df67fd520e697254de5f4c956e87afdefd56e455eecf549800ee196738f61e83d07d284dda04253e1a4c33ec68f150b6b5faa5" 
        -H  "x-gridy-apiuser: 000000000" 
        -H  "x-gridy-utctime: 1734732919817" 
        -H  "x-gridy-cnonce: 8dcb623a-b56e-4534-838b-5e9e" 
        -H  "Content-Type: application/json; charset=utf-8" 
        -d "{            
            "id":< Your own reference >,
            "utctime": <UTC Timestamp>,
            "apiUser":< Your Api User ID >,
            "type":990,
            "body":'{}' 
            }"
      import io.gridy.client.ApiClient;
  import io.gridy.client.ApiException;
  import io.gridy.client.Configuration;
  import io.gridy.client.auth.HmacSha512Auth;
  import io.gridy.client.model.*;
  import io.gridy.client.api.GridyIdServiceApi

  ApiClient defaultClient = new ApiConfig.Builder()
             # Configure API User Id
            .withApiUser( System.getEnv("GRIDY_API_USER")  )
             # Configure API User Secret
            .withApiSecret( System.getEnv("GRIDY_API_SECRET")  )
             # Configure API Environment
            .withApiEnv(GridyEnv.LIVE)
            .build();

      GridyIdServiceApi apiInstance = new GridyIdServiceApi(defaultClient);
      ApiRequest apiRequest = new ApiRequest(); 

      try {
        ModelApiResponse result = apiInstance.time(apiRequest);
        System.out.println(result);

      } catch (ApiException e) {

        System.err.println("Exception when calling GridyIdServiceApi#time");
        System.err.println("Status code: " + e.getCode());
        System.err.println("Reason: " + e.getResponseBody());
        System.err.println("Response headers: " + e.getResponseHeaders());

        e.printStackTrace();
}
    import gridyapi_client
    from gridyapi_client.rest import ApiException
    from pprint import pprint

    # Defining the host is optional and defaults to https://api.gridy.io
    # See configuration.py for a list of all supported configuration parameters.
    configuration = gridyapi_client.Configuration(
            host="https://api.gridy.io"
    )

    # The client must configure the authentication and authorization parameters
    # in accordance with the API server security policy.

    # Configure API User Id
    configuration.api_user = os.environ["GRIDY_API_USER"]

    # Configure API User Secret
    configuration.api_secret = os.environ["GRIDY_API_SECRET"]

    # Enter a context with an instance of the API client
    with gridyapi_client.ApiClient(configuration) as api_client:

        # Create an instance of the API class
        api_instance = gridyapi_client.GridyIDServiceApi(api_client)
        api_request = {
                  "id": < Your own reference >,
                  "utctime": "",
                  "apiUser": "Your API User ID",
                  "type": 990,
                  "body": '{ }'
              }  # ApiRequest | The JSON body of the request.

        try:
            # Send or Cancel a Gridy ID MFA challenge request.
            api_response = api_instance.time(api_request)
            print("The response of GridyIDServiceApi->time:\n")
            pprint(api_response)
        except ApiException as e:
            print("Exception when calling GridyIDServiceApi->time: %s\n" % e)
    import 'package:gridy_mfa_client/gridyapi.dart';

    final api = GridyClient()
        .setHmacAuth('<Your 9-digit API User ID>','<Your API Secret Key>')
        .getGridyIDServiceApi();

        ApiRequest request = ApiRequest( (r) =>
        r
        ..id = 'Your refernence ID'
        ..utcTime = DateTime.now()
            .toUtc().millisecondsSinceEpoch
            .toString()
        ..type = 990
        ..apiUser = 'Your API User ID'
        ..body = '{}'
        );

    try {
            final response = await api.time(apiRequest);
            final _dresponse = ApiResponse( (r) =>
            r
             ..id = _response.data?.id
             ..utcTime = _response.data?.utcTime
             ..status = _response.data?.status
             ..message = _response.data?.message
             ..code = _response.data?.code
             ..moreInfo = _response.data?.moreInfo
              );

            print(response);

    } catch on DioException (e) {
            print("Exception when calling GridyIDServiceApi->time: $e\n"); 
    }
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Your Gridy API User ID
$config = GridyAPI\Client\Configuration::getDefaultConfiguration()->setApiUser( 'YOUR_API_USER_ID');

// Configure Your Gridy API Secret Key
$config = GridyAPI\Client\Configuration::getDefaultConfiguration()->setApiUser( 'YOUR_API_SECRET_KEY');


$apiInstance = new GridyAPI\Client\Service\GridyIDServiceApi(
        // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
        // This is optional, `GuzzleHttp\Client` will be used as default.
        new GuzzleHttp\Client(),
        $config
);

$api_request = { 
    "id":< Your own reference >,
    "utctime": <UTC Timestamp>,
    "apiUser": "Your API User ID",
    "type":990,
    "body":'{}'
    }; // \GridyAPI\Client\Model\ApiRequest | The JSON body of the request.

try {
        $result = $apiInstance->time($api_request);
        print_r($result);

} catch (Exception $e) {
        echo 'Exception when calling GridyIDServiceApi->time: ', $e->getMessage(), PHP_EOL;
}
    var GridyIdApi = require('gridy_client');
    var defaultClient = GridyIdApi.ApiClient.instance;
    var api = new GridyIdApi.GridyIDServiceApi()

    var apiRequest = { 
     "id":< Your own reference >,
     "utctime": "<UTC Timestamp>",
     "apiUser": "<Your API User ID>",
     "type":990,
     "body":'{ }'
    }; // {ApiRequest} The JSON body of the request.

    var callback = function(error, data, response) {
        if (error) {
                console.error(error);
        } else {
                console.log('API called successfully. Returned data: ' + data);
        }
    };

    api.time(apiRequest, callback);


Postman Collection

Don't want to write code? Check out the Gridy Postman Collection or the API Explorer for a no-code way to get started with Gridy's API.

Responses

All responses are JSON, with errors indicated in response bodies as negative integer status values (all application-level errors return a HTTP 400 status code)

   
Http Status API Status Description
200OK15000
400Bad Request
-1001API User validation error  
-1003API User validation error  
-1026API User permissions error  
-2003Account validation error  
-2004Account blocked  
-2005Account too many failed attempts  
-2006Account locked  
-2007Account disabled  
-2008Account not active  
-2009Account locked  
-2010Account temporarily disabled  
-2017Account lock enabled  
-2038Account lockdown activated  
-4004HTTP Header x-gridy-utctime missing  
-4005HTTP Header x-gridy-utctime format error  
-4006HTTP Header x-gridy-nonce missing  
-4007HTTP Header x-gridy-nonce format error  
-4008HTTP Header x-gridy-apiuser missing error  
-4009HTTP Header x-gridy-apiuser format error  
-4000HTTP Authorization Header missing  
-4001HTTP Authorization Header format error  
-4026HTTP Authorization Header HMAC signature missing
-4027HTTP Authorization Header HMAC signature format error  
-4028HTTP Authorization Header HMAC apiuser missing error  
-4029HTTP Authorization Header HMAC apiuser format error  
-4030HTTP Authorization Header HMAC algorithm missing error  
-4031HTTP Authorization Header HMAC algorithm format error  
-4032HTTP Authorization Header HMAC headers missing error  
-4033HTTP Authorization Header HMAC headers format error  
-4034HTTP Authorization Header HMAC nonce reused error  
-4035HTTP Authorization Header HMAC timestamp reused error  
-4036HTTP Authorization Header HMAC utctime clock drift error  
-4037HTTP Authorization Header HMAC signature error  
-6021API request blocked - IP address location blocked based on user defined rules
500Internal Error-5000API request rejected due to an Internal error.
Examples
Http Status API Status Description JSON
200OK15000
{
  "id":"YIWCC1729892595213"
  "utctime":"2024-10-25T21:43:15.566431Z"
  "status":200
  "code":15000
  "message": '{"utc-time":"1729892595"}'
  "more info":"https://support.gridy.io/status?code=15000"
}