Skip to content

API documentation

Torsten Rehn edited this page Jan 23, 2015 · 1 revision

TeamVault features a complete REST API using JSON. Authentication is using the normal usernames and passwords used for logging into the web application.

NOTE: The API is also web-browsable by logging in normally and going to https://example.com/api/secrets/

This is a listing of all supported API objects and their operations.

"Secret" is an umbrella term for describing passwords, files and credit card information stored in TeamVault.

curl -H "Content-Type: application/json" -X POST --data "@secret_create.json" -u user:pass https://example.com/api/secrets/

secret_create.json:

{
	"access_policy": "request",
	"allowed_groups": [
		"group1",
		"group2"
	],
	"allowed_users": [
		"trehn"
	],
	"description": "This is a description.",
	"name": "My new secret",
	"needs_changing_on_leave": true,
	"password": "s3cR1t!!1",
	"url": "https://secret.example.com/",
	"username": "jdoe"
}
or secret_create_file.json:
{
	"allowed_users": [
		"trehn"
	],
	"name": "My new secret",
	"file": "ZmlsZSBjb250ZW50Cg==",
	"filename": "secret.jpg"
}
or secret_create_cc.json:
{
    "allowed_users": [
	"trehn"
    ],
    "name": "My new secret",
    "holder": "Card holder name",
    "number": "1234 5678 9012 3456",
    "expiration_month": "04",
    "expiration_year": "2029",
    "security_code": "123",
    "password": "optional for 3D-Secure etc."
}

curl -u user:pass https://example.com/api/secrets/

Search will find and prefer partial string matches in secret names (so it is suitable for search-as-you-type), but also consider descriptions, usernames and filenames using a full text search.

curl -u user:pass https://example.com/api/secrets/?search=foo

curl -u user:pass https://example.com/api/secrets/1/

After finding the secret, get the linked secret revision from the "current_revision" field:

curl -u user:pass https://example.com/api/secret-revisions/1/

From there, access the data using the "data_url" field:

curl -u user:pass https://example.com/api/secret-revisions/1/data