Who is this article for?
Incydr Professional, Enterprise, Gov F2, and Horizon, no.
Incydr Basic, Advanced, and Gov F1, no.
CrashPlan Cloud, no.
Retired product plans, yes.
CrashPlan for Small Business, no.
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.
- For assistance with using the Code42 API, contact your Customer Success Manager (CSM) to engage the Code42 Professional Services team.
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.
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
You can use the Code42 API for a wide variety of tasks. For more information, see Sample uses of 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.
Your authority server hosts API documentation in a Code42 API doc viewer and in a Swagger viewer. For more information, see Code42 API documentation viewers.
The documentation viewer you use depends on the version of the API:
- Version 1
Go to https:/ /<authority-server-address>:4285/apidocviewer.
- Versions 3 and later
Go to https://<authority-server-address>:4285/swagger and select a version in the API Version menu in the upper-right.
Syntax and usage
The Code42 API uses a standardized API syntax and command structure. For more information, see Code42 API syntax and usage.
- GET: Retrieve a resource.
- POST: Create a new resource.
- PUT: Update an existing resource.
- DELETE: Destroy an existing resource.
The path to API resources varies with their version:
- Version 1: /api/
- Version 3: /c42api/v3/
- Version 4: /api/v4/
Later versions follow the same convention.
Use the Code42 API by sending requests to your authority server. In your requests, specify the path, resource, and parameters that define your request.
curl -X GET -u 'username' 'https://authority-server.example.com:4285/api/Useremail@example.com&active=true' curl -X POST -u 'username' 'https://authority-server.example.com:4285/c42api/v3/ping/error'
The curl commands listed here expose your credentials on your device and your network. For more secure alternatives, see Authentication below.
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.
To use basic authentication, include your Code42 username in the API request and supply your password when prompted. For example:
curl -u "username" https://authority-server.example.com:4285/api/Computer
To use token authentication:
- Include your Code42 username in a GET request to auth/jwt and supply your password when prompted. For example:
curl -u "username" https://authority-server.example.com:4285/c42api/v3/auth/jwt?useBody=true
- From the reply, copy the value of the v3_user_token. In the example below, it is
- Place the token in the header of your API requests. For example:
-H "authorization: Bearer eyJjdHki...txd546Eg"
In versions prior to 8.2, use the
v3_user_token parameter in the authentication request header. For example, instead of
-H "Authorization: Bearer <AuthToken>" use
-H "Authorization: v3_user_token <AuthToken>" .