def bulk_add(
    httpreq: Request, request: NewBulkObservableAddRequest
) -> BulkObservableAddResponse:
    """Bulk-creates new observables in the database."""
    response = BulkObservableAddResponse()
    for new_observable in request.observables:
        try:
            observable_obj = observable.save(
                type=new_observable.type,
                value=new_observable.value,
                tags=new_observable.tags,
            )
            audit.log_timeline(httpreq.state.username, observable_obj)
            rbac.set_acls(observable_obj, user=httpreq.state.user)
        except (ValueError, RuntimeError):
            response.failed.append(new_observable.value)
            continue
        response.added.append(observable_obj)
    if not response.added:
        raise HTTPException(
            status_code=400,
            detail="Failed to add any observables.",
        )
    return response
Bulk-creates new observables in the database.
core/web/apiv2/observables.py