Use cURL Integration With Artifactory

🚧

Planned for deprecation

jf rt curl is planned for deprecation. Use jf api instead, which covers all JFrog Platform APIs (Access, Artifactory, AppTrust, OneModel, and others), reuses your configured server credentials, and does not require a curl binary on your PATH.

The jf rt curl command runs cURL against Artifactory using the server and credentials you already configured in the JFrog CLI, so you do not pass URLs or authentication headers manually. You need the curl executable on your PATH. Use this page to prepare your environment, understand options, and follow copy-pastable examples for common REST requests.

Command syntax

jf rt curl <api-path> [--server-id=<server-id>]

Where:

  • <api-path> β€” Artifactory REST path only (no host), for example /api/system/ping or /api/build.
  • After the path, pass the same flags you would pass to curl (method, headers, body, and so on), except the full Artifactory URL and login credentials (the CLI adds those).
  • <server-id> β€” Optional. Configured server ID from jf config add. If --server-id is omitted, the default configured server is used.

Example:

jf rt curl /api/system/ping

Prerequisites

To prepare for using jf rt curl:

  • JFrog CLI is installed β€” verify with jf --version
  • curl is in your PATH β€” verify with curl --version
  • At least one Artifactory server is configured β€” run jf config add to add a server, then jf config show to confirm. For more information, see Configuring the CLI.

πŸ“˜

Note

This command supports only Artifactory REST APIs, which are accessible under https://<JFrog base URL>/artifactory/api/.

πŸ“˜

Note

jf rt curl always returns exit code 0, regardless of the HTTP response status. A 401, 403, or 5xx response still produces a zero exit code. To detect failures in scripts, parse the JSON response body or use -w '%{http_code}' to inspect the HTTP status code.

πŸ“˜

Note

By default, curl prints a progress meter to stdout alongside the response body. Add the -s (silent) flag to suppress it, for example jf rt curl -s -XGET /api/system/ping.


Command Parameters

The following table lists the command name and abbreviation.

ParameterCommand and description
Command namert curl
Abbreviationrt cl

Command Options

The following table describes the command option.

OptionDescription
--server-id[Optional] Server ID configured using the jf config add command. If not specified, the default configured server is used.

Environment Variables

The following table describes the related environment variable.

VariableDescription
JFROG_CLI_SERVER_ID[Optional] Server ID to use as an alternative to --server-id. The --server-id flag takes priority if both are set.

Command Arguments

The following table describes command arguments.

ArgumentDescription
cURL arguments and flagsThe same list of arguments and flags passed to cURL, except for the following changes. You should not pass the full Artifactory URL. Send the REST endpoint URI instead. You should not pass login credentials. Use --server-id instead.

Supported cURL Options

The following table lists commonly used cURL flags.

OptionDescriptionExample
-XHTTP method (non-GET)-X POST, -X PUT, -X DELETE. Omit for GET requests (curl infers GET by default).
-HAdd HTTP header-H "Content-Type: application/json"
-dSend request data/body-d '{"key":"value"}'
-vVerbose outputShows detailed request/response
-sSilent modeSuppress progress meter
-oOutput to file-o response.json
-iInclude headersInclude response headers in output

Authentication

To authenticate jf rt curl requests:

Servers can be configured with any of the following authentication methods:

  • Username and Password
  • Access Token
  • API Key

To verify which authentication method is configured for a server, run jf config show.

If you receive a Token failed verification error, your access token may have expired. To update credentials, re-run jf config add with the same server ID, or generate a new token in the JFrog Platform UI under User Management > Access Tokens.


cURL Integration Examples

Example 1: Send a GET Request to the Default Server

To send a GET request to the /api/build endpoint on the default server:

  1. Run:
jf rt curl /api/build
  1. Inspect the JSON response (see the following expected output).

Expected response:

{
  "builds": [...]
}

Example 2: Send a GET Request to a Specific Server

To send a GET request to /api/build on a specific configured server:

  1. Run:
jf rt curl /api/build --server-id my-rt-server
  1. Inspect the JSON response.

Expected response:

{
  "builds": [...]
}

Example 3: Create a Repository with PUT

To create a new local repository with PUT /api/repositories/<repo-key>:

  1. Run (replace my-repo with your repository key):
jf rt curl -XPUT -H "Content-Type: application/json" \
  -d '{"key":"my-repo","rclass":"local","packageType":"generic"}' \
  /api/repositories/my-repo
  1. Confirm the success message in the output.

To update an existing repository's configuration, use POST /api/repositories/<repo-key> instead of PUT.

Expected response:

Successfully created repository 'my-repo'

Example 4: Ping the Artifactory Server

To verify that the Artifactory REST API responds:

πŸ“˜

Note

jf rt curl always injects your stored credentials. If your credentials are expired or invalid, this endpoint returns 401, which indicates an authentication failure, not a connectivity problem. To perform a pure connectivity check without authentication, use jf rt ping instead.

  1. Run:
jf rt curl -s /api/system/ping
  1. Confirm the response body is OK.

The -s flag suppresses the curl progress meter so the response body appears cleanly. Without -s, the progress meter is printed to stdout and the OK response is concatenated onto its last line, which breaks output parsing.

Expected response:

OK

Example 5: Return System Version

To return Artifactory version information:

  1. Run:
jf rt curl /api/system/version
  1. Parse or read the returned JSON.

Expected response:

{
  "version": "7.x.x",
  "revision": "...",
  "addons": [...],
  "license": "..."
}
πŸ“˜

Note

The actual response may include additional fields such as servicesVersions and entitlements, depending on your Artifactory version and configuration.

Example 6: Use Verbose Mode for Debugging

To run a request with verbose cURL output (for debugging):

🚧

Warning

Verbose mode prints your full Bearer token in plaintext in the authorization: request header line. Do not share terminal output, screenshots, or continuous integration (CI) logs captured with -v. Doing so exposes your live access token. If you have already shared verbose output, revoke and rotate the token immediately in the JFrog Platform UI under User Management > Access Tokens.

πŸ“˜

Note

When you use -v with GET requests, omit -XGET because curl infers GET as the default method. Explicitly passing -XGET causes curl to print "Note: Unnecessary use of -X or --request, GET is already inferred."

  1. Run:
jf rt curl -v /api/system/version
  1. Review the verbose trace (do not share logs that include the authorization header).

Expected output includes:

* Connected to <your-instance>.jfrog.io port 443
* using HTTP/2
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [authorization: Bearer eyJ... (full token printed here)]
< HTTP/2 200
{"version":"7.x.x","revision":"...","addons":[...],"license":"..."}
πŸ“˜

Note

The authorization header format depends on how your server was configured: Bearer <token> for access token authentication, or Basic <base64> for username and password. If you configured the server with --basic-auth-only, you will see Basic in that output.

Example 7: Delete a Repository

To delete a repository with the REST API:

🚧

Warning

This operation permanently deletes the repository and all of its contents. It cannot be undone. Only run this against a test or temporary repository.

πŸ“˜

Note

The repository must already exist. You can create a test repository using Example 3 (replace my-repo with my-temp-repo in that example), or substitute an existing repository key for my-temp-repo.

  1. Run (use a disposable repository key):
jf rt curl -XDELETE /api/repositories/my-temp-repo
  1. Confirm the deletion message in the output.

Expected response:

Repository 'my-temp-repo' and all its content have been removed successfully.

Example 8: Use Environment Variable for Server Selection

To select the server with JFROG_CLI_SERVER_ID instead of --server-id:

  1. Set the variable and run the request:
export JFROG_CLI_SERVER_ID=my-rt-server
jf rt curl /api/build
  1. Inspect the JSON response.

Expected response:

{
  "builds": [...]
}

Example 9: Reload Plugins

To reload Artifactory plugins (administrator, self-managed only):

πŸ“˜

Note

Plugin management through the REST API is only available for self-managed Artifactory installations. This endpoint is not available on JFrog SaaS. On SaaS instances, the server returns HTTP 403 with "Function is not supported when running on the cloud". The CLI still exits with code 0 in both cases.

  1. Run:
jf rt curl -XPOST /api/plugins/reload
  1. Confirm the success message on self-managed instances.

Expected response (self-managed only):

Plugins have been successfully reloaded.

Example 10: Upload a File with PUT

To upload a local file using PUT and -d @:

  1. Run (replace paths and repository with your values):
jf rt curl -XPUT -d @/path/to/local/file.txt /my-repo/path/to/file.txt
  1. Confirm HTTP 201 and the JSON summary in the output.
πŸ“˜

Note

The repository my-repo must exist. See Example 3 to create it.

Expected response (HTTP 201):

{
  "repo": "my-repo",
  "path": "/path/to/file.txt",
  "created": "...",
  "createdBy": "<username>",
  "downloadUri": "https://<your-instance>.jfrog.io/artifactory/my-repo/path/to/file.txt",
  "mimeType": "text/plain",
  "size": "<bytes>",
  "checksums": {
    "sha1": "...",
    "md5": "...",
    "sha256": "..."
  },
  "originalChecksums": {
    "sha256": "..."
  },
  "uri": "https://<your-instance>.jfrog.io/artifactory/my-repo/path/to/file.txt"
}

Common Errors

To diagnose a failed jf rt curl request, match your symptom to this table.

The following table lists common errors, causes, and resolutions.

ErrorCauseResolution
{"status":401,"message":"Token failed verification: parse"}Access token is expired or malformedRe-run jf config add to update credentials, or generate a new token in the JFrog Platform UI.
{"status":403,...}Authenticated but insufficient permissionsUse an administrator token, or request the required permissions from your Artifactory administrator.
{"status":404,...}Repository or path does not existVerify the repository key and path, and create the repository first if needed (see Example 3).
{"status":403,"message":"Function is not supported when running on the cloud"} on /api/plugins/reloadEndpoint not available on JFrog SaaSThis feature is self-managed only. See Example 9.
Progress meter printed before response bodycurl default behaviorAdd -s to suppress, for example jf rt curl -s -XGET /api/system/ping.
Note: Unnecessary use of -X or --request-XGET is redundant because curl infers GET by defaultDrop -XGET for GET requests. Use -X only for POST, PUT, or DELETE.