Skip to Content
APIsAuthentication

Authenticate to Grepr REST APIs

By default, most endpoints in the Grepr REST APIs are restricted and cannot be accessed until enabled. To enable access, you must have credentials provided by the Grepr support team. You then use these credentials to obtain an access token for API authentication.

To obtain the required credentials, contact Grepr support. The support team will send the following credentials:

  • client ID: A unique identifier for your organization.
  • client secret: A secret key that is used to authenticate your organization.

The exception to the access restrictions for the Grepr APIs is the POST /v1/triggers endpoint to create external triggers.

Obtain an access token for Grepr REST APIs

Grepr uses Auth0  as the identity provider for authentication. To obtain an access token to use with Grepr APIs, you send a request to the token endpoint:

POST https://grepr-prod.us.auth0.com/oauth/token endpoint.

The following example submits a token request using the curl command. client_id and client_secret are the credential values provided by Grepr support:

curl --url https://grepr-prod.us.auth0.com/oauth/token \ --header 'content-type: application/json' \ --data '{ "client_id": "<client_id>", "client_secret": "<client_secret>", "audience": "service", "grant_type": "client_credentials" }'

Example response:

{ "access_token": "<access_token>", "token_type": "Bearer", "expires_in": "86400", "scope": "service" }

Note: This token will have access to all APIs that Grepr provides to its customers. If you need to restrict access to specific APIs, contact Grepr support to reduce the access scope of your token.

Use the access token with the Grepr API

To authenticate against the Grepr APIs, include the access token as a Bearer token in the Authorization header of all API requests. If you submit a request using an expired token, a 401 Unauthorized response is returned and you must obtain a new access token.

The following example uses the curl command to get all Asynchronous Streaming jobs from the jobs endpoint.

curl -XGET "https://<your_org_id>.app.grepr.ai/api/v1/jobs?processing=STREAMING&execution=ASYNCHRONOUS" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your_access_token>"

Example response:

{ "items": [ { "id": "0ABC123DEF456", "name": "Demo Job", "version": 0, "organizationId": "grepr", "execution": "ASYNCHRONOUS", "processing": "STREAMING", "state": "RUNNING", "desiredState": "RUNNING", "jobGraph": { "vertices": [], "edges": [] }, "createdAt": "2021-09-01T00:00:00Z", "updatedAt": "2021-09-01T00:00:00Z", "tags": { "createdUsing": "API", "createdByUser": "Hardworking Beaver" } } ] }

Notes

  • Token Expiration : The access token has a limited lifetime (usually 86400 seconds / 24 hours). You must obtain a new token when it expires.
  • Security : Keep the credentials you receive and the auth token secure. To prevent unauthorized access, do not expose these values in your client-side code or commit them to a version control repository.
Last updated on