Skip to content

create_abuse_report async

create_abuse_report(
    report: ReportData,
    *,
    config_overrides: Optional[AsyncAbuseSignalClientConfig] = None,
    correlation_id: Optional[CorrelationId] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateAbuseReportResponse

Submits a structured report. Amazon Web Services validates it and returns a report ID. A successful response confirms that Amazon Web Services received your report. It doesn't mean that Amazon Web Services has reached an outcome. Use GetAbuseReportStatus with the report ID to check the report's status and outcome.

This operation is idempotent within a time window. If you provide a clientToken, duplicate requests within 24 hours return the existing report ID. If you omit it, the service generates a token scoped to 5 minutes.

Cross-Region data residency: By submitting a report, you instruct Amazon Web Services to store it in all supported Regions (us-east-1, us-west-2, and eu-west-2), including across the United States and Europe. If data must remain in a single Region, do not include it in the report.

Parameters:

  • report (ReportData) –

    The abuse report data in XARF format. Provide the report under the xarf key.

  • correlation_id (Optional[CorrelationId], default: None ) –

    An optional correlation ID for tracking the report in the reporter's system. The service echoes this value back in responses, and you can use it to filter reports with ListAbuseReportStatuses.

  • client_token (Optional[ClientToken], default: None ) –

    An optional, client-provided idempotency token that ensures the operation completes no more than once. If the token matches a previous request within 24 hours, the service returns the existing report ID instead of creating a new report. When you omit this token, the service automatically generates one that is scoped to a 5-minute window.

Raises:

  • AccessDeniedException –

    The caller does not have sufficient access to perform this operation. Verify that the caller has the specific IAM permission for the operation it is calling (for example, abuse:CreateAbuseReport, abuse:GetAbuseReportStatus, or abuse:ListAbuseReportStatuses). Grant only the actions each caller requires.

  • InternalServerException –

    An unexpected error occurred during the processing of the request. This error is retryable; check the Retry-After header before you retry.

  • ThrottlingException –

    The request was denied due to request throttling. This error is retryable; retry with exponential backoff.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service, which indicates that the request is not well-formed. Check fieldList for the specific members that failed validation.

  • ConflictException –

    The request conflicts with the current state of the resource. For example, an idempotency token was reused with a different payload.

  • SubmissionRequirementException –

    The report is well-formed and satisfies the XARF schema, but it does not meet one or more submission requirements (for example, the submission lookback window or source_identifier restrictions). This error is distinct from ValidationException (HTTP 400), which indicates that the report is not well-formed. Retrying the same report will not succeed; the report content must change.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Submit an abuse report in X-ARF format

>>> await client.create_abuse_report(report={'xarf': {}})
Source code in docs_src/capo_abuse_signal/_services/async_abuse_signal.py
async def create_abuse_report(
    self,
    report: "capo_abuse_signal.types.report_data.ReportData",
    *,
    config_overrides: Optional[AsyncAbuseSignalClientConfig] = None,
    correlation_id: Optional[
        "capo_abuse_signal.types.correlation_id.CorrelationId"
    ] = None,
    client_token: Optional[
        "capo_abuse_signal.types.client_token.ClientToken"
    ] = None,
) -> (
    "capo_abuse_signal.types.create_abuse_report_response.CreateAbuseReportResponse"
):
    """<p>Submits a structured report. Amazon Web Services validates it and returns a report ID. A successful response confirms that Amazon Web Services received your report. It doesn't mean that Amazon Web Services has reached an outcome. Use <a>GetAbuseReportStatus</a> with the report ID to check the report's status and outcome.</p> <p>This operation is idempotent within a time window. If you provide a <code>clientToken</code>, duplicate requests within 24 hours return the existing report ID. If you omit it, the service generates a token scoped to 5 minutes.</p> <important> <p> <b>Cross-Region data residency:</b> By submitting a report, you instruct Amazon Web Services to store it in all supported Regions (<code>us-east-1</code>, <code>us-west-2</code>, and <code>eu-west-2</code>), including across the United States and Europe. If data must remain in a single Region, do not include it in the report.</p> </important>

    Args:
        report: <p>The abuse report data in XARF format. Provide the report under the <code>xarf</code> key.</p>
        correlation_id: <p>An optional correlation ID for tracking the report in the reporter's system. The service echoes this value back in responses, and you can use it to filter reports with <a>ListAbuseReportStatuses</a>.</p>
        client_token: <p>An optional, client-provided idempotency token that ensures the operation completes no more than once. If the token matches a previous request within 24 hours, the service returns the existing report ID instead of creating a new report. When you omit this token, the service automatically generates one that is scoped to a 5-minute window.</p>

    Raises:
        capo_abuse_signal.errors.access_denied_exception.AccessDeniedException: <p>The caller does not have sufficient access to perform this operation. Verify that the caller has the specific IAM permission for the operation it is calling (for example, <code>abuse:CreateAbuseReport</code>, <code>abuse:GetAbuseReportStatus</code>, or <code>abuse:ListAbuseReportStatuses</code>). Grant only the actions each caller requires.</p>
        capo_abuse_signal.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request. This error is retryable; check the <code>Retry-After</code> header before you retry.</p>
        capo_abuse_signal.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. This error is retryable; retry with exponential backoff.</p>
        capo_abuse_signal.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service, which indicates that the request is not well-formed. Check <code>fieldList</code> for the specific members that failed validation.</p>
        capo_abuse_signal.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. For example, an idempotency token was reused with a different payload.</p>
        capo_abuse_signal.errors.submission_requirement_exception.SubmissionRequirementException: <p>The report is well-formed and satisfies the XARF schema, but it does not meet one or more submission requirements (for example, the submission lookback window or <code>source_identifier</code> restrictions). This error is distinct from <code>ValidationException</code> (HTTP 400), which indicates that the report is not well-formed. Retrying the same report will not succeed; the report content must change.</p>
        capo_abuse_signal.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Submit an abuse report in X-ARF format

        >>> await client.create_abuse_report(report={'xarf': {}})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_abuse_signal.types.create_abuse_report_request.CreateAbuseReportRequest]",
    ) -> AsyncOperationResponse[
        "capo_abuse_signal.types.create_abuse_report_response.CreateAbuseReportResponse"
    ]:
        import capo_abuse_signal._operations.abuse_report_api.create_abuse_report

        (
            output,
            http_response,
        ) = await capo_abuse_signal._operations.abuse_report_api.create_abuse_report.async_create_abuse_report(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_abuse_signal.types.create_abuse_report_request.CreateAbuseReportRequest",
    ) -> dict[str, Any]:
        import capo_abuse_signal.types.create_abuse_report_request

        return capo_abuse_signal.types.create_abuse_report_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateAbuseReport", redact_input=_redact_input),
    )
    input_: capo_abuse_signal.types.create_abuse_report_request.CreateAbuseReportRequest = {
        "report": report
    }
    if correlation_id is not None:
        input_["correlation_id"] = correlation_id
    if client_token is not None:
        input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output