Use this API to interact with the Cargo package registry, including its sparse index, registry configuration, and crate downloads. Generally these endpoints are used by Cargo itself and are not meant for manual consumption. For more information, see the package registry.
Get the sparse index for a Cargo crate (1-character name)
GET /api/v4/projects/{id}/packages/cargo/1/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
package_Path, | String | The cargo package name |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get the sparse index for a Cargo crate (2-character name)
GET /api/v4/projects/{id}/packages/cargo/2/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
package_Path, | String | The cargo package name |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get the sparse index for a Cargo crate (3-character name)
GET /api/v4/projects/{id}/packages/cargo/3/{first_char}/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
first_Path, | String | First character of the cargo package name |
package_Path, | String | The cargo package name |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get config.json
GET /api/v4/projects/{id}/packages/cargo/config.json
This will be used by cargo for further requests
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Download a Cargo crate
GET /api/v4/projects/{id}/packages/cargo/{package_name}/{package_version}/download
This endpoint serves the .crate file for a given package name and version
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
package_Path, | String | The cargo package name |
package_Path, | String | The cargo package version |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get the sparse index for a Cargo crate (4+ character name)
GET /api/v4/projects/{id}/packages/cargo/{prefix_1}/{prefix_2}/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
prefix_Path, | String | First two characters of the cargo package name |
prefix_Path, | String | Next two characters of the cargo package name |
package_Path, | String | The cargo package name |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |