Skip to main content

Who is this article for?

Incydr
Code42 for Enterprise
CrashPlan for Enterprise
CrashPlan for Small Business

Incydr, yes.

CrashPlan for Enterprise, yes.

Code42 for Enterprise, yes.

CrashPlan for Small Business, no.

This article applies to Code42 cloud environments.

Other available versions:

On-premises

HOME
GETTING STARTED
RELEASE NOTES
FAQs
APIs
SYSTEM STATUS
Code42 Support

Introduction to the Code42 API

Who is this article for?

Incydr
Code42 for Enterprise
CrashPlan for Enterprise
CrashPlan for Small Business

Incydr, yes.

CrashPlan for Enterprise, yes.

Code42 for Enterprise, yes.

CrashPlan for Small Business, no.

This article applies to Code42 cloud environments.

Other available versions:

On-premises

Overview

This article provides an introduction to the Code42 API. You can use the APIs to perform a variety of tasks, from performing automated actions to integrating with existing systems. 

Considerations

  • For assistance with using the Code42 API, contact your Customer Success Manager (CSM) to engage the Code42 Professional Services team. Or, post your question to the Code42 community to get advice from fellow Code42 administrators.
  • The Code42 API documentation viewers are publicly available. You can see them in a browser without signing in. But the API resources themselves only work for you under these conditions:

    • You have a product plan that includes access to the Code42 API.
    • Your credentials rely on local authentication. SSO or authentication through any third-party provider will not work.
    • Your role provides permission to access the data necessary to a given API resource. For example, if you do not have permission to change device settings in the Code42 console, then you don't have permission to change device settings with the API.

    The Code42 API and the documentation viewers are built to serve both the Code42 cloud and on-premises Code42 environments.
    Customers using the Code42 cloud will see documentation about API resources that to do not apply to the Code42 cloud. For example:

    • Resources for managing LDAP.
    • Resources for managing storage server.

    If your API calls fail because you do not have permission to use them, you will see reply messages like these:

    • HTTP 401 Unauthorized
    • HTTP 401 Could not authenticate user
    • Your Code42 product plan does not permit use of the Code42 API.

Examples of tasks you can perform using the Code42 API

See the following articles for just some of the tasks you can perform using the Code42 API:

Tools for interacting with the Code42 API

The Code42 API is accessible through many tools, such as web browsers, scripting tools, and programming languages. Although the examples in our articles show use of the command line tool curl to interact with the Code42 API, you can use many different tools. 

For more information see Tools for interacting with the Code42 API.

API documentation

API documentation is available for both our administrative APIs and feature-specific APIs. For more information, see Code42 API documentation viewers.

Administrative API documentation

The administrative APIs provide our basic API resources. For example, the Computer resource provides access to your users' devices, the Org resource provides access to your organizations, and the User resource provides access to your users.

Administrative API documentation is available in a Swagger viewer and an API documentation viewer directly from the Code42 cloud.

Swagger

For the Code42 cloud, administrative API resources reside at https://<cloud-address>/swagger. The resource you use depends on your Code42 cloud address:

API docviewer

For the Code42 cloud, administrative API resources reside at https://<cloud-address>/apidocviewer. The resource you use depends on your Code42 cloud address:

Feature API documentation

View API documentation for specific features with the Swagger viewer. The resource you use depends on your Code42 cloud location.

Audit Log API

Use the Code42 API to search Audit Log events and export the results in CSV, CEF, or JSON format to integrate with other security tools. For more information, see Search Audit Log events with the Code42 API.

Syntax and usage

The Code42 API uses a standardized API syntax and command structure. For more information, see Code42 API syntax and usage.

HTTP methods

  • GET: Retrieve a resource.
  • POST: Create a new resource.
  • PUT: Update an existing resource.
  • DELETE: Destroy an existing resource.

Base paths 

The path to API resources varies with their version:

  • Version 1: /api/
  • Version 3: /c42api/v3/
  • Version 4: /api/v4/
  • and so on for later versions...

Example commands

Use the Code42 API by sending requests to the Code42 cloud. In your requests, specify the path, resource, and parameters that define your request. 

Copied!
curl -X GET -u 'username' 'https://console.us.code42.com/api/User?q=eg@ex.com&active=true'
curl -X POST -u 'username' 'https://console.us.code42.com/c42api/v3/ping/error'
Authenticating with curl
The curl commands listed here expose your credentials on your device and your network. For more secure alternatives, see Authentication below.

Authentication

Most requests to the Code42 API must be authenticated. While you can use basic authentication (username and password) we strongly recommend using a token authentication method for increased security.

For more information about authentication with the Code42 API, see Code42 API authentication methods.

Basic authentication

To use basic authentication, include your Code42 username in the API request and supply your password when prompted. For example:

Copied!
curl -u "username" https://console.us.code42.com/api/Computer

Token authentication

To use token authentication: 

  1. Include your Code42 username in a GET request to auth/jwt and supply your password when prompted. For example:
Copied!
curl -u "username" https://console.us.code42.com/c42api/v3/auth/jwt?useBody=true
  1. From the reply, copy the value of the v3_user_token. In the example below, it is eyJjdHki...txd546Eg
{"data":{"v3_user_token":"eyJjdHki...txd546Eg"},"error":null,"warnings":null}
  1. Place the token in the header of your API requests. For example:
-H "authorization: v3_user_token eyJjdHki...txd546Eg" 

Related topics