v3

latestOpenAPI 3.1.02026-07-311,4541,5202.3 MB
spans

Retrieve Span

Mixin for views that need superadmin access to all resources.

Provides FOUR key features (all bundled - no separate mixins needed):

  1. Queryset routing (superadmin sees all, regular user sees own org)
  2. Organization injection (post/patch/put auto-inject org)
  3. Object ownership checking (auto-registers ObjectOwnershipPermission)
  4. Superadmin-only field protection (certain fields can only be modified by superadmins)

Inherits from:

  • ObjectOwnershipMixin: Config attributes + auto-permission registration
  • OrganizationInjectionMixin: Cross-org write protection + org injection

Config attributes (inherited from ObjectOwnershipMixin):

  • ownership_object_field_name: Field on object (default: "organization_id")
  • ownership_user_field_name: Field on user (default: "curr_org_id")
  • is_allowing_global_object_read: Allow reading global objects (default: False)
  • is_allowing_org_admin_access: Allow org admins access to any object in their org (default: False)
  • is_requiring_org_admin_for_write: Require org admin for writes (default: False)

Config attributes (superadmin-only fields):

  • superadmin_only_fields: List of field names that only superadmins can modify (default: []) On CREATE: Fields are stripped from non-superadmin requests (model defaults apply) On UPDATE: Non-superadmins trying to change these fields get PermissionDenied

  • superadmin_lock_field: Field name that locks the entire object for non-superadmins (default: None) When this field is truthy on the instance, non-superadmins cannot modify ANY field. Common use case: is_managed=True means Keywords AI manages this resource, users can't edit it.

Note: Writing to global objects (ownership field is None) always requires superadmin.

Usage (detail view):

class MyDetailView(SuperAdminMixin, JWTAndAPIKeyAuthenticationViewMixin, RetrieveUpdateDestroyAPIView):
    # Optional: customize ownership config (inherited from ObjectOwnershipMixin)
    is_allowing_global_object_read = True

    def get_regular_user_queryset(self):
        return MyModel.objects.filter(organization_id=self.request.user.curr_org_id)

    def get_superadmin_queryset(self):
        return MyModel.objects.all()

Usage (superadmin-only fields):

class IntegrationView(SuperAdminMixin, JWTAndAPIKeyAuthenticationViewMixin, RetrieveUpdateDestroyAPIView):
    superadmin_only_fields = ['is_managed']  # Only superadmins can modify is_managed
    superadmin_lock_field = 'is_managed'  # When is_managed=True, object is locked for non-superadmins

    def get_regular_user_queryset(self):
        return Integration.objects.filter(organization_id=self.request.user.curr_org_id)

    def get_superadmin_queryset(self):
        return Integration.objects.all()

Usage (related-object org pattern like PromptVersion - PREFERRED: annotate queryset):

from django.db.models import F

class PromptVersionView(SuperAdminMixin, JWTAndAPIKeyAuthenticationViewMixin, RetrieveUpdateDestroyAPIView):
    def get_regular_user_queryset(self):
        # Annotate organization_id so ownership checks work automatically
        return PromptVersion.objects.filter(
            prompt__organization_id=self.request.user.curr_org_id
        ).annotate(organization_id=F("prompt__organization_id"))

    def get_superadmin_queryset(self):
        return PromptVersion.objects.annotate(organization_id=F("prompt__organization_id"))

Alternative (override method - only if annotation not possible):

class PromptVersionView(SuperAdminMixin, JWTAndAPIKeyAuthenticationViewMixin, RetrieveUpdateDestroyAPIView):
    def get_affiliated_object_organization_id(self, instance):
        return instance.prompt.organization_id  # Org is on parent object

DO NOT use inline checks like this: # ❌ BAD - easy to forget in branching code def get_queryset(self): if has_staff_role(self.request.user): return MyModel.objects.all() return MyModel.objects.filter(...)

get/api/request-logs/{unique_id}/

Path parameters

unique_idstring required

Headers

Authorizationstring required

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

Response

idstring required
input_wordsstring required
output_wordsstring required
input_charsstring required
output_charsstring required
organization_key_namestring required
organization_idstring required
unique_organization_idstring
organization_namestring
error_messagestring
warningsstring required
annotation_statusstring required
keywordsai_paramsstring required
full_requeststring required
full_responsestring required
metadatastring required
toolsstring required
tool_callsstring required
prompt_messagesstring required
completion_messagestring required
{"stackTrail":"components:schemas:CHLogV2Detail:properties:completion_messages","oasType":"schema","type":"unknown","description":"Any type"}
inputstring
outputstring
{"stackTrail":"components:schemas:CHLogV2Detail:properties:variables","oasType":"schema","type":"unknown","description":"Any type"}
temperaturenumber double
max_tokensinteger
top_pnumber double
frequency_penaltynumber double
presence_penaltynumber double
stopstring
{"stackTrail":"components:schemas:CHLogV2Detail:properties:response_format","oasType":"schema","type":"unknown","description":"Any type"}
unit_pricesobject
component_costsobject
custom_identifierstring
group_identifierstring
blurredboolean
start_timestring date-time
timestampstring date-time
load_balance_group_idstring
prompt_tokensinteger
completion_tokensinteger
prompt_cache_hit_tokensinteger
prompt_cache_creation_tokensinteger
reasoning_tokensinteger
total_request_tokensinteger
is_token_count_estimatedinteger
costnumber double
llm_gateway_markup_ratenumber double
service_tierstring
model_discountnumber double
pricing_tierstring
audio_input_filestring
audio_output_filestring
organization_key_idstring
user_emailstring
modelstring
provider_idstring
categorystring
propertiesstring
cache_bitinteger
cache_miss_bitinteger
cache_keystring
latencynumber double
tokens_per_secondnumber double
time_to_first_tokennumber double
routing_timenumber double
statusstring
has_tool_callsboolean
status_codeinteger
log_methodstring
log_typestring
environmentstring
streamboolean
evaluation_identifierstring
customer_identifierstring
customer_emailstring
customer_namestring
customer_user_unique_idstring
used_custom_credentialboolean
deployment_namestring
deployment_idstring
prompt_namestring
prompt_idstring
prompt_version_numberinteger
system_textstring
prompt_textstring
completion_textstring
prompt_message_countinteger
completion_message_countinteger
trace_unique_idstring
span_unique_idstring
span_namestring
span_parent_idstring
span_workflow_namestring
session_identifierstring
span_linksstring
trace_group_identifierstring
thread_identifierstring
thread_unique_idstring
storage_object_keystring
period_startstring date-time
period_endstring date-time
unique_idstring
respan_gateway_request_idstring
full_textstring