Use cURL integration with Artifactory

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 auth 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 calls.

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 c 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 c add to add a server, then jf config show to confirm. See Configuring the CLI for full setup instructions.

📘

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 will still produce 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: jf rt curl -s -XGET /api/system/ping.


Commands Params

ParameterCommand / Description
Command namert curl
Abbreviationrt cl

Command Options

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

Environment Variables

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

ArgumentDescription
cURL arguments and flagsThe same list of arguments and flags passed to cURL, except for the following changes: (1) The full Artifactory URL should not be passed. Instead, the REST endpoint URI should be sent. (2) The login credentials should not be passed. Instead, the --server-id should be used.

Supported cURL Options

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 c 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 expected output below).

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: Get System Version

To retrieve 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):

🚧

Security warning

Verbose mode prints your full Bearer token in plaintext in the authorization: request header line. Do not share terminal output, screenshots, or CI logs captured with -v — doing so will expose 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 using -v with GET requests, omit -XGET since 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 here.

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.

📘

Prerequisite

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 my-temp-repo below with an existing repository key.

  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 (admin, self-hosted only):

📘

Note

Plugin management via the REST API is only available for self-hosted 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 will still exit with code 0 in both cases.

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

Expected response (self-hosted 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.
📘

Prerequisite

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:

ErrorCauseResolution
{"status":401,"message":"Token failed verification: parse"}Access token is expired or malformedRe-run jf c add to update credentials, or generate a new token in the JFrog Platform UI
{"status":403,...}Authenticated but insufficient permissionsUse an admin token, or request the required permissions from your Artifactory administrator
{"status":404,...}Repository or path does not existVerify the repository key and path; 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-hosted only; see Example 9
Progress meter printed before response bodycurl default behaviorAdd -s to suppress: jf rt curl -s -XGET /api/system/ping
Note: Unnecessary use of -X or --request-XGET is redundant; curl infers GET by defaultDrop -XGET for GET requests; use -X only for POST, PUT, DELETE