Before accessing available endpoints, make sure you have created a valid access token. Also make sure to read the introduction to get familiar with our API.
Available endpoints:
Get all folders
Method: GET
To get a list of all your folders, you can use the endpoint https://inprivy.io/api/folders
. In order to create secrets, you will need to specify a folder id. Use this endpoint to obtain the id of the folder you would like to create a secret in.
$access_token = 'YOUR-ACCESS-TOKEN'; curl https://inprivy.io/api/folders \ -H "Authorization: Bearer $access_token" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json'
Response
{ "success": true, "version": "1.0", "data": [ { "id": "050a67aa-7829-460b-bd9d-c5475608442f", "label": "Default", "created_at": "2023-02-26T12:15:07.000000Z", "drafts_count": 1, "secrets_count": 2 }, { "id": "805e7de8-61f3-4d0e-bcb8-bdc0bafc1374", "label": "Second Folder", "created_at": "2023-03-01T19:50:23.000000Z", "drafts_count": 3, "secrets_count": 1 } ]}
Get all secrets
Method: GET
To get all your shareable secrets (= no drafts) and their corresponding links, you may use the endpoint https://inprivy.io/api/secrets
.
$access_token = 'YOUR-ACCESS-TOKEN'; curl https://inprivy.io/api/secrets \ -H "Authorization: Bearer $access_token" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json'
Response
{ "success": true, "version": "1.0", "data": [ { "id": "6103e302-32d8-4d45-8f4a-a490bb0c2920", "label": "env variables for Project X", "expires_at": "2023-03-31T23:00:00.000000Z", "folder_id": "050a67aa-7829-460b-bd9d-c5475608442f", "created_at": "2023-03-01T20:07:46.000000Z", "link": { "url": "https:\/\/inprivy.link\/389de549487802f75d6df3854e0bc4e9-0lOFmPHbvYflBM2R8GyB22MSjaG4YO", "created_at": "2023-03-01T20:07:46.000000Z" } }, { "id": "1e23bf14-82b6-4174-b541-186bd4321c91", "label": "Netflix password", "expires_at": "2023-04-01T19:25:33.000000Z", "folder_id": "050a67aa-7829-460b-bd9d-c5475608442f", "created_at": "2023-03-02T19:25:33.000000Z", "link": { "url": "https:\/\/inprivy.link\/e7228ce19fbe636876a2b55d686bd21f-8GmQCMk8iFiPjoVAbhLWoufTzwXGgu", "created_at": "2023-03-02T19:25:33.000000Z" } } ]}
Get one Secret
Method: GET
To get the details of a specific secret, you can use the endpoint https://inprivy.io/api/secret/{id}
. Replace {id}
with the actual id of the secret. This can be found by either getting all secrets (see previous endpoint), or within the list of secrets in your dashboard.
$access_token = 'YOUR-ACCESS-TOKEN'; curl https://inprivy.io/api/secret/{id} \ -H "Authorization: Bearer $access_token" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json'
Response
{ "success": true, "version": "1.0", "data": { "id": "6103e302-32d8-4d45-8f4a-a490bb0c2920", "label": "env variables for Project X", "expires_at": "2023-03-31T23:00:00.000000Z", "folder_id": "050a67aa-7829-460b-bd9d-c5475608442f", "created_at": "2023-03-01T20:07:46.000000Z", "link": { "url": "https:\/\/inprivy.link\/389de549487802f75d6df3854e0bc4e9-0lOFmPHbvYflBM2R8GyB22MSjaG4YO", "created_at": "2023-03-01T20:07:46.000000Z" } }}
Create a secret
Method: POST
To create a secret, use the endpoint https://inprivy.io/api/secret
. The supplied data must be valid JSON.
{ "label": "Secret created via API", "note": "This is the secret\nAnd a new line\nAnother new line", "folder_id": "050a67aa-7829-460b-bd9d-c5475608442f", "open_limit": 5, "notify": true}
Make sure to use a valid folder id, see endpoint /folders
. To disable the open limit, enter 0
(zero) instead of a positive number. Secrets created via API will expire after 30 days, you cannot set an expiration date.
Use the note
field to enter the secret information. To create multi-line secrets, use \n
as a new line indicator.
Response
{ "success": true, "version": "1.0", "data": { "id": "6103e302-32d8-4d45-8f4a-a490bb0c2920", "label": "Secret created via API", "expires_at": "2023-03-31T23:00:00.000000Z", "folder_id": "050a67aa-7829-460b-bd9d-c5475608442f", "created_at": "2023-03-01T20:07:46.000000Z", "link": { "url": "https:\/\/inprivy.link\/389de549487802f75d6df3854e0bc4e9-0lOFmPHbvYflBM2R8GyB22MSjaG4YO", "created_at": "2023-03-01T20:07:46.000000Z" } }}