API Client

API Client represents a low level interface for Secret Version API. All API operation can be performed using this.

class abeja.secret_version.api.client.APIClient(credential: Optional[dict] = None, timeout: Optional[int] = None, max_retry_count: Optional[int] = None)

A Low-Level client for Secret Version API

from abeja.secret_version import APIClient

api_client = APIClient()
create_secret_version(organization_id: str, secret_id: str, value: str) → dict

create a secret version

API reference: POST /secret-manager/organizations/<organization_id>/secrets/<secret_id>/versions

Request Syntax:
organization_id = "1410000000000"
secret_id = "3053595942757"
value = "AKIAIOSFODNN7EXAMPLE"
response = api_client.create_secret_version(organization_id, secret_id, value)
Params:
  • organization_id (str): organization identifier

  • secret_id (str): secret identifier

  • value (str): secret value

Return type:

dict

Returns:

Response Syntax:

{
    "id": "7285296397904",
    "organization_id": "3617229248589",
    "secret_id": "9598242896082",
    "value": "AKIAIOSFODNN7EXAMPLE",
    "version": 2
    "status": "active",
    "provider": "aws-secret-manager",
    "created_at": "2025-05-01T18:58:18.712607Z",
    "updated_at": "2025-05-01T18:58:18.712610Z",
}
Raises:
  • BadRequest

  • Unauthorized: Authentication failed

  • InternalServerError

delete_secret_version(organization_id: str, secret_id: str, version_id: str) → dict

delete a secret version

API reference: DELETE /secret-manager/organizations/<organization_id>/secrets/<secret_id>/versions/<version_id>

Request Syntax:
organization_id = "1410000000000"
secret_id = "3053595942757"
version_id = "1234567890123"
response = api_client.delete_secret_version(organization_id, secret_id, version_id)
Params:
  • organization_id (str): organization identifier

  • secret_id (str): secret identifier

  • version_id (str): version identifier

Return type:

dict

Returns:

Response Syntax:

{
    "message": "secret_version_id 1234567890123 successfully deleted"
}
Raises:
  • BadRequest

  • Unauthorized: Authentication failed

  • InternalServerError

get_secret_version(organization_id: str, secret_id: str, version_id: str) → dict

get secret version

API reference: GET /secret-manager/organizations/<organization_id>/secrets/<secret_id>/versions/<version_id>

Request Syntax:
organization_id = "1410000000000"
secret_id = "3053595942757"
version_id = "1234567890123"
response = api_client.get_secret_version(organization_id, secret_id, version_id)
Params:
  • organization_id (str): organization identifier

  • secret_id (str): secret identifier

  • version_id (str): version identifier

Return type:

dict

Returns:

Response Syntax:

{
    "id": "4914543680412",
    "organization_id": "3617229248589",
    "secret_id": "3471958194321",
    "status": "active",
    "value": "test",
    "version": 2,
    "provider": "aws-secret-manager",
    "created_at": "2025-05-01T04:02:20.962352Z",
    "updated_at": "2025-05-01T07:40:00.204109Z",
}
Raises:
  • BadRequest

  • Unauthorized: Authentication failed

  • InternalServerError

get_secret_versions(organization_id: str, secret_id: str, offset: Optional[int] = 0, limit: Optional[int] = 50) → dict

get secret versions

API reference: GET /secret-manager/organizations/<organization_id>/secrets/<secret_id>/versions

Request Syntax:
organization_id = "1410000000000"
secret_id = "3053595942757"
offset = 0
limit = 50
response = api_client.get_secret_versions(organization_id, secret_id, offset, limit)
Params:
  • organization_id (str): organization identifier

  • secret_id (str): secret identifier

  • offset (int): [optional] offset of versions ( which starts from 0 )

  • limit (int): [optional] max number of versions to be returned

Return type:

dict

Returns:

Response Syntax:

{
    "pagination": {
        "count": 1,
        "has_next": false,
        "limit": 50,
        "offset": 0
    },
    "versions": [
        {
            "id": "3884379411160",
            "organization_id": "3617229248589",
            "secret_id": "3471958194321",
            "value": "test",
            "version": 1,
            "status": "active",
            "provider": "aws-secret-manager",
            "created_at": "2025-04-30T19:01:19.216304Z",
            "updated_at": "2025-05-01T07:35:01.002633Z",
        }
    ]
}
Raises:
  • BadRequest

  • Unauthorized: Authentication failed

  • InternalServerError

update_secret_version(organization_id: str, secret_id: str, version_id: str, status: str) → dict

update a secret version

API reference: PATCH /secret-manager/organizations/<organization_id>/secrets/<secret_id>/versions/<version_id>

Request Syntax:
organization_id = "1410000000000"
secret_id = "3053595942757"
version_id = "1234567890123"
status = "inactive"
response = api_client.update_secret_version(organization_id, secret_id, version_id, status)
Params:
  • organization_id (str): organization identifier

  • secret_id (str): secret identifier

  • version_id (str): version identifier

  • status (str): version status (‘active’ or ‘inactive’)

Return type:

dict

Returns:

Response Syntax:

{
    "id": "7285296397904",
    "organization_id": "3617229248589",
    "secret_id": "9598242896082",
    "value": "test",
    "version": 2,
    "status": "inactive",
    "provider": "aws-secret-manager",
    "created_at": "2025-05-01T18:58:18.712607Z",
    "updated_at": "2025-05-01T19:04:40.398828Z",
}
Raises:
  • BadRequest

  • Unauthorized: Authentication failed

  • InternalServerError