Skip to main content

Using Scribe API

The first step in accessing Scribe's API is getting an API key. Scribe uses the auth0 client credentials flow to enable you to retrieve an API key.

To request a token run this script:

curl --request POST \
--url 'https://scribe-hub-production.us.auth0.com/oauth/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type='client_credentials' \
--data client_id=YOUR_CLIENT_ID \
--data client_secret=YOUR_CLIENT_SECRET \
--data audience='api.production.scribesecurity.com'

The CLIENT_ID and CLIENT_SECRET in this script are the same CLIENT_ID and CLIENT_SECRET you can retrieve from your Scribe Hub Integrations page.

Scribe Integration Secrets

The response to the token request looks like this:

{
"access_token":"eyJz93a...k4laUWw",
"token_type":"Bearer",
"expires_in":86400
}

The access_token in the response is your API key.

Scribe uses swagger-client to enable access to our API. Swagger-client is a JavaScript module that allows you to fetch, resolve, and interact with OpenAPI documents to resolve API calls.

To use it you should first download and install swagger-client. If the Python package is hosted on GitHub, you can install it directly from GitHub

pip install git+https://github.com//.git

(you may need to run pip with root permission: sudo pip install git+https://github.com//.git)

Then import the package:

import swagger_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import swagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: JWT
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.DatasetApi(swagger_client.ApiClient(configuration))
body = swagger_client.LoginRequest() # LoginRequest | (optional)

try:
# This endpoint is used to get an admin token, either use client-id and secret OR the refresh token.
api_response = api_instance.get_admin_token_action(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling DatasetApi->get_admin_token_action: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost:4000

ClassMethodHTTP requestDescription
DatasetApiget_admin_token_actionGET /dataset/tokenThis endpoint is used to get an admin token, either use client-id and secret OR the refresh token.
DatasetApiget_datasets_actionPOST /dataset/dataThis endpoint is used to retrieve data from a dataset with a filter.
DatasetApilist_datasets_input_actionGET /datasetThis endpoint is used to list the available datasets with their schema.
DefaultApidatasetPOST /dataset/tokenThis endpoint is used to exchange a team product key with a superset data-access token.
EvidenceApidelete_evidence_actionDELETE /evidence/{file_id}Delete evidence object.
EvidenceApidownload_evidence_actionGET /evidence/{file_id}Create pre-signed URL to POST file content.
EvidenceApifinish_upload_evidence_actionPOST /evidence/finishMark file transfer as finished.
EvidenceApilist_evidence_actionPOST /evidence/listGet a list of processes for specific queries.
EvidenceApiupload_evidence_actionPOST /evidenceCreate pre-signed URL to POST file content.

API Usage Examples

You can find working usage examples here.