Documents API

Create a Document

https://d33wubrfki0l68.cloudfront.net/46256db48654ea43d1fd9377023f4d876582d839/ab631/_images/plans-available-all.png
POST /v1/vaults/(string: vault_id)/documents

Creates a Document in the specified vault.

Parameters:
  • vault_id – string(req’d)
Form Parameters:
 
  • document – b64 string(req’d) - base64 encoded JSON Document string
  • schema_id – string(optional) - schema_id of the Schema definition by which the Document will be indexed against
  • owner_id – string(optional) - owner_id of the newly created Document. If null or omitted, the newly created Document will be ownerless.
Request Headers:
 
Status Codes:

Example Request

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents \
    -u [API_KEY | ACCESS_TOKEN]: \
    -X POST \
    -d "document=e30=&schema_id=00000000-0000-0000-0000-000000000000&owner_id=00000000-0000-0000-0000-000000000000"

Example Response

{
    "document_id": "00000000-0000-0000-0000-000000000000",
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}

Read a Document

https://d33wubrfki0l68.cloudfront.net/46256db48654ea43d1fd9377023f4d876582d839/ab631/_images/plans-available-all.png
GET /v1/vaults/(string: vault_id)/documents/(string: document_id)

Gets multiple Documents at once. If reading a single document, returns only the document’s contents as a base64-encoded string with no JSON framing.

Parameters:
  • vault_id – string(req’d)
  • document_id – string(req’d) - comma separated list of Document IDs to retrieve. At most 100 ids can be fetched at a time. Note: This endpoint consumes an Operation for every document returned, so a request with 50 ids will count as 50 Operations.
Request Headers:
 
Status Codes:

Example Request

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001 \
    -X GET \
    -u [API_KEY | ACCESS_TOKEN]:

Example Response (multiple documents)

{
    "documents": [
        {
            "document": "e30=",
            "id": "00000000-0000-0000-0000-000000000000",
            "owner_id": "00000000-0000-0000-0000-000000000000"
        },
        {
            "document": "e30=",
            "id": "00000000-0000-0000-0000-000000000001",
            "owner_id": "00000000-0000-0000-0000-000000000000"
        }
    ],
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}

Example Response (single document)

e30=

List all Documents

https://d33wubrfki0l68.cloudfront.net/46256db48654ea43d1fd9377023f4d876582d839/ab631/_images/plans-available-all.png
GET /v1/vaults/(string: vault_id)/documents

List all Documents in a Vault.

Parameters:
  • vault_id – string(req’d)
Query Parameters:
 
  • full – boolean(optional, default: ‘false’) - retrieve entire Document contents. Note: If true, then this endpoint consumes an Operation for every document returned. If false, only a single Operation is used.
  • page – integer(optional, default: 1) - specify page number for paginated response
  • per_page – integer(optional, default: 100, max: 500) - specify number of results per page in paginated response
Request Headers:
 
Status Codes:

Example Request

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents \
    -X GET \
    -u [API_KEY | ACCESS_TOKEN]:

Example Response

{
    "data": {
        "full_document": false,
        "items": [
            {
                "id": "00000000-0000-0000-0000-000000000000",
                "schema_id": "00000000-0000-0000-0000-000000000000",
                "vault_id": "00000000-0000-0000-0000-000000000000",
                "owner_id": "00000000-0000-0000-0000-000000000000"
            }
        ],
        "page": 1,
        "per_page": 100,
        "total": 1
    },
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}

List all Documents with Schema

https://d33wubrfki0l68.cloudfront.net/8513b318bb356a4044b0b241683868db1da61329/895a1/_images/plans-available-standard-plus.png
GET /v1/vaults/(string: vault_id)/schemas/(string: schema_id)/documents

List all Documents in a vault associated with a specified Schema.

Parameters:
  • vault_id – string(req’d)
  • schema_id – string(req’d)
Query Parameters:
 
  • full – boolean(optional, default: ‘false’) - retrieve entire Document contents. Note: If true, then this endpoint consumes an Operation for every document returned. If false, only a single Operation is used.
  • page – integer(optional, default: 1) - specify page number for paginated response
  • per_page – integer(optional, default: 100, max: 500) - specify number of results per page in paginated response
Request Headers:
 
Status Codes:

Example Request

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/schemas/00000000-0000-0000-0000-000000000000/documents \
    -X GET \
    -u [API_KEY | ACCESS_TOKEN]:

Example Response

{
    "data": {
        "full_document": false,
        "items": [
            {
                "id": "00000000-0000-0000-0000-000000000000",
                "schema_id": "00000000-0000-0000-0000-000000000000",
                "vault_id": "00000000-0000-0000-0000-000000000000",
                "owner_id": "00000000-0000-0000-0000-000000000000"
            }
        ],
        "page": 1,
        "per_page": 100,
        "total": 1
    },
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}

Update a Document

https://d33wubrfki0l68.cloudfront.net/46256db48654ea43d1fd9377023f4d876582d839/ab631/_images/plans-available-all.png
PUT /v1/vaults/(string: vault_id)/documents/(string: document_id)

Updates a Document having document_id.

Parameters:
  • vault_id – string(req’d)
  • document_id – string(req’d)
Form Parameters:
 
  • document – b64 string(req’d) - new base64 encoded JSON Document string
  • schema_id – string(optional) - schema_id of the Schema definition by which the Document will be indexed against. If no schema_id is provided, then the Document will stay associated to its existing Schema.
  • owner_id – string(optional) - owner_id of the user the Document will be owned by. If no owner_id is provided, then the Document will stay owned by its existing owner. If null, then the Document will become ownerless.
Request Headers:
 
Status Codes:

Example Request

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000 \
    -u [API_KEY | ACCESS_TOKEN]: \
    -X PUT \
    -d "document=e30=&schema_id=00000000-0000-0000-0000-000000000000&owner_id=00000000-0000-0000-0000-000000000000"

Example Response

{
    "document_id": "00000000-0000-0000-0000-000000000000",
    "owner_id": "00000000-0000-0000-0000-000000000000",
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}

Update a Document’s Owner

https://d33wubrfki0l68.cloudfront.net/46256db48654ea43d1fd9377023f4d876582d839/ab631/_images/plans-available-all.png
PUT /v1/vaults/(string: vault_id)/documents/(string: document_id)/owner

Updates only the owner_id for a Document having document_id. This can be used to update the owner of a document if changes to the document content are undesirable. If changes to the document content are desired, see the Update Document operation.

Parameters:
  • vault_id – string(req’d)
  • document_id – string(req’d)
Form Parameters:
 
  • owner_id – string(req’d) - owner_id of the user the Document will be owned by. If '', then the Document will become ownerless. Note: unlike the update endpoint, the owner_id field cannot be omitted, it must be specified with an empty value to remove the owner.
Request Headers:
 
Status Codes:

Example Requests

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000/owner \
    -u [API_KEY | ACCESS_TOKEN]: \
    -X PUT \
    -d "owner_id=00000000-0000-0000-0000-000000000000"

Removing an owner:

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000/owner \
    -u [API_KEY | ACCESS_TOKEN]: \
    -X PUT \
    -d "owner_id="

Example Response

{
    "document_id": "00000000-0000-0000-0000-000000000000",
    "owner_id": "00000000-0000-0000-0000-000000000000",
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}

Delete a Document

https://d33wubrfki0l68.cloudfront.net/46256db48654ea43d1fd9377023f4d876582d839/ab631/_images/plans-available-all.png
DELETE /v1/vaults/(string: vault_id)/documents/(string: document_id)

Deletes a Document from a Vault.

Parameters:
  • vault_id – string(req’d)
  • document_id – string(req’d)
Request Headers:
 
Status Codes:

Example Request

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000 \
    -X DELETE \
    -u [API_KEY | ACCESS_TOKEN]:

Example Response

{
    "document_id": "00000000-0000-0000-0000-000000000000",
    "owner_id": "00000000-0000-0000-0000-000000000000",
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}

Reindex a Document

https://d33wubrfki0l68.cloudfront.net/8513b318bb356a4044b0b241683868db1da61329/895a1/_images/plans-available-standard-plus.png
POST /v1/vaults/(string: vault_id)/documents/(string: document_id)/reindex

Reindex a Document against its Schema.

Parameters:
  • vault_id – string(req’d)
  • document_id – string(req’d)
Request Headers:
 
Status Codes:

Example Request

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000/reindex \
    -X POST \
    -u [API_KEY]:

Example Response

{
    "document_id": "00000000-0000-0000-0000-000000000000",
    "result": "success",
    "transaction_id": "00000000-0000-0000-0000-000000000000"
}