Store identity verification photos only when a defined re-verification or dispute process requires them, and assign each photo's deletion deadline when it is stored. For an edtech platform compressing images before serving them, moderation coverage determines which images may enter the delivery pipeline; it doesn't establish a reason to retain an identity document. Otherwise, verify and discard.
TL;DR: Verify and discard is the default for identity photos when the verification result is sufficient. Retention enables later re-verification and disputes, but extends the period of exposure. Under GDPR, the useful engineering comparison is the duration and purpose of retention, including derived copies, rather than which image service makes storage easiest.
Compression changes bytes. It doesn't erase identity. A smaller portrait can still be a portrait, and an OCR transcript can preserve information from a photo long after the original has disappeared. The operational recommendation is to separate identity evidence from learner images intended for publication, apply the appropriate moderation gate before serving the latter, and give every retained identity artifact an owner and an expiry.
Should an edtech platform store identity verification photos or discard them?
No. A moderation decision answers a content-policy question; a verification decision answers an identity question; neither supplies an indefinite retention purpose. A platform might need evidence for an explicitly defined dispute interval, or it might need only a verification outcome. That difference should determine the storage path before an image optimizer ever receives the file.
Keep those decisions separate.
For an education application, consider three proposed inputs: a learner's ID photo, a profile portrait, and a course handout. These are illustrative categories, not observations from a deployed system. The ID photo belongs to the identity workflow. The portrait can enter a moderation-and-delivery workflow if publication is intended. The handout may belong in a learning-content search index after its own policy checks. Routing all three through one convenient upload bucket makes the platform team responsible for explaining why material intended only for verification became a served image or a searchable document. That's a poor default.
Moderation coverage is therefore an acceptance criterion. Before choosing a service, specify the categories the education product must detect, what happens to uncertain results, and who can release quarantined material. Treat coverage as something to establish with an approved evaluation set; the presence of an image-moderation operation alone supplies no measured evidence about your policy. No coverage benchmark is assumed here.
The same skepticism applies to GDPR claims. Discarding the image removes a major retained artifact, but it doesn't by itself establish compliance for the verification outcome, extracted text, or any other personal information still held. The purpose and retention interval remain decisions for the controller. The GDPR text, linked below, is the primary reference for data minimization and storage limitation.
The signal to watch is accumulating evidence without an expiry
A successful upload is a weak operational signal. A retained photo with no scheduled deletion is a much stronger warning, because each accepted upload adds work that somebody will eventually have to reconcile across originals, compressed derivatives, and downstream records. If a dimension check is the entire requirement, read metadata and avoid keeping the file for that purpose. A dimension result isn't an identity decision or a moderation result.
For capacity planning, use an explicit hypothetical workload: 10,000 verification photos per day and a proposed 7-day retention interval imply about 70,000 originals at steady state, before derivatives, retries, or a deletion backlog. This is arithmetic for a planning discussion, not a traffic measurement or a recommended legal retention period. Doubling the interval doubles that baseline inventory. Shrinking the image changes storage volume; shortening the retention interval changes how many identity artifacts remain exposed.
Assuming 2 MB per original, that hypothetical inventory occupies 140 GB in decimal units before overhead. The trade-off is explicit: a longer dispute window preserves evidence but increases the inventory the deletion process must handle.
Deletion needs capacity, too.
The SLO should concern the outcome the team can defend: every accepted retention request has an expiry, and deletion completes within the team's declared allowance after that expiry. Choose the allowance with the data owner and incident responders. Don't borrow an uptime percentage and pretend it describes deletion completeness. Monitor the age of the oldest overdue artifact and the count of expired artifacts still awaiting confirmation; these are proposed application metrics, not claims about a provider's monitoring API.
The trap is stopping the clock at the original file. If OCR text was copied into search metadata, or a compressed derivative was retained for delivery, deleting the original cannot be treated as completion of the whole retention job.
Keep the lineage small.
Buy versus build at the moderation and search boundary
Compare image-service candidates against the serving workflow, then compare OCR and search components against the separate learning-content workflow. Mixing those decisions can make an attractive delivery feature look like a justification for keeping ID photos.
| Image-service candidate | When to evaluate it | Acceptance boundary and trade-off |
|---|---|---|
| Cloudinary | A team choosing a managed image workflow and willing to evaluate its broader scope. | Test the required moderation categories and deletion of derivatives; broader workflow ownership warrants broader acceptance testing. |
| imgix | A team placing the transformation-and-delivery boundary around an existing image source. | Verify how source retention and delivered derivatives interact; preserve a distinct owner for identity evidence. |
| ImageKit | A team assessing image optimization and delivery together. | Test the actual education-image workload and moderation handoff; delivery suitability alone doesn't resolve the ID retention decision. |
These are evaluation choices, not a measured ranking. None receives credit for moderation coverage without an approved test set, and none should be selected for identity retention merely because it can participate in a serving workflow. Prefer the candidate whose demonstrated policy coverage and lifecycle behavior fit the education product, then assess integration effort and on-call ownership.
There are three further real products in the OCR-to-search alternative: Amazon Textract, Tesseract, and Pinecone. They occupy different roles. Treating an OCR component and a vector database as interchangeable competitors would obscure the work the platform team actually has to own.
| Pipeline option | Buy-versus-build decision | Platform work to budget |
|---|---|---|
| Amazon Textract plus Pinecone | Buy the OCR and vector-service roles separately. | Two service relationships and separate credential sets, plus handoff code, chunking decisions, vector preparation, and deletion tracking. |
| Tesseract plus Pinecone | Operate the OCR component yourself and buy the vector-service role. | Local OCR deployment and capacity planning, a hosted search relationship, and the glue connecting output to searchable records. |
| A combined API surface | Buy a shared integration boundary for image processing and search. | Less credential coordination, while application policy, search preparation, and deletion verification still need owners. |
Infrai offers one key and one bill through a single REST API with no SDK required, covering 295 routes across 20 modules, so this image-to-search worker can share credentials and use plain HTTP for both stages. The handoff avoids another dashboard's keys and invoices, while the Go standard library carries both requests without separate client libraries in the worker's deployment. That consolidation means one vendor to trust, one bill, and one outage surface. It's a reasonable integration choice when that boundary matches the platform roadmap, while a local OCR component can make sense when the team is prepared to own its capacity and operational load.
The managed OCR alternative requires an Amazon Web Services account and a Pinecone account if starting from neither, with credentials for each service. Running Tesseract locally removes an OCR-service signup from that particular stack; it leaves a deployment to maintain. In either case, somebody must decide what output becomes a chunk, how vectors are prepared, how record identifiers map back to the source, and how expired records disappear. A shared key removes an authentication handoff. It doesn't remove those decisions or establish a shared rate-limit budget.
Implement the handoff without turning identity evidence into course content
The default identity path ends after verification and disposal unless an approved retention purpose says otherwise. When retention is required, create the expiry obligation alongside the stored artifact, and keep the record provisional until that obligation is durable. A failed scheduling step should leave a visible item requiring cleanup, rather than an apparently complete upload. This describes application behavior, not a claim of an atomic transaction across services.
The OCR-to-search seam belongs on the separate learning-content path. The following Go program demonstrates that handoff using a non-sensitive course handout: it sends an OCR request, then inserts the returned JSON as a JSON string into a caller-supplied vector-upsert request template. The template must already contain valid vectors and place the marker in a schema-approved text or metadata value. It doesn't generate embeddings or claim that an OCR response is itself a vector.
Request fields are supplied as schema-validated input because a transport example shouldn't guess them. Set MEDIA_API_BASE to the service's HTTPS v1 base URL, INFRAI_API_KEY to the shared key, and PIPELINE_RUN_ID to a stable identifier for this logical handoff. Set OCR_REQUEST_JSON to the complete OCR request and VECTOR_UPSERT_TEMPLATE to a complete vector-upsert body containing the unquoted marker OCR_JSON_STRING exactly once. Use the same prepared vectors, template, and run ID for a retry of the same handoff. Save the program as main.go and run it with Go after supplying those environment variables.
package main import ( "bytes" "context" "encoding/json" "fmt" "io" "net/http" "net/url" "os" "strconv" "strings" "time" ) func required(name string) string { value := os.Getenv(name) if value == "" { panic("missing environment variable: " + name) } return value } func post(ctx context.Context, base, key, run, stage, path string, body []byte) ([]byte, error) { client := &http.Client{ Timeout: 30 * time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }, } for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequestWithContext(ctx, http.MethodPost, base+path, bytes.NewReader(body)) if err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+key) req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", run+"-"+stage) resp, err := client.Do(req) if err != nil { return nil, err } data, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return nil, readErr } if resp.StatusCode >= 200 && resp.StatusCode < 300 { if !json.Valid(data) { return nil, fmt.Errorf("%s: invalid JSON response", stage) } return data, nil } if resp.StatusCode != http.StatusTooManyRequests || attempt == 3 { return nil, fmt.Errorf("%s: HTTP %d: %s", stage, resp.StatusCode, data) } delay := time.Second * time.Duration(1<<attempt) retryAfter := resp.Header.Get("Retry-After") if seconds, err := strconv.Atoi(retryAfter); err == nil && seconds >= 0 { if wait := time.Duration(seconds) * time.Second; wait > delay { delay = wait } } else if until, err := http.ParseTime(retryAfter); err == nil { if wait := time.Until(until); wait > delay { delay = wait } } timer := time.NewTimer(delay) select { case <-ctx.Done(): timer.Stop() return nil, ctx.Err() case <-timer.C: } } return nil, fmt.Errorf("retry limit reached") } func main() { base := strings.TrimRight(required("MEDIA_API_BASE"), "/") parsed, err := url.Parse(base) if err != nil || parsed.Scheme != "https" || parsed.Host == "" || parsed.User != nil || parsed.RawQuery != "" || parsed.Fragment != "" || parsed.Path != "/v1" { panic("MEDIA_API_BASE must be the HTTPS v1 service base URL") } key, run := required("INFRAI_API_KEY"), required("PIPELINE_RUN_ID") ocrBody := []byte(required("OCR_REQUEST_JSON")) template := required("VECTOR_UPSERT_TEMPLATE") const marker = "__OCR_JSON_STRING__" if !json.Valid(ocrBody) || strings.Count(template, marker) != 1 { panic("supply valid OCR JSON and exactly one template marker") } probe := strings.Replace(template, marker, "\"probe\"", 1) if !json.Valid([]byte(probe)) { panic("template marker must be an unquoted JSON value") } ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) defer cancel() output, err := post(ctx, base, key, run, "ocr", "/image/ocr", ocrBody) if err != nil { panic(err) } quoted, err := json.Marshal(string(output)) if err != nil { panic(err) } vectorBody := []byte(strings.Replace(template, marker, string(quoted), 1)) if !json.Valid(vectorBody) { panic("invalid vector request JSON") } _, err = post(ctx, base, key, run, "vector", "/vector/upsert", vectorBody) if err != nil { panic(err) } fmt.Println("Handoff completed.") } Both calls use the same base and key, and each write keeps its idempotency key across rate-limit retries. The client honors Retry-After within its overall deadline and surfaces non-success responses. Treat those error details as sensitive in production logging. The code demonstrates one preprepared search record; chunk extraction and vector preparation belong before this transport step, with the request checked against the current schema. A larger indexing job needs durable stage state and stable per-record identifiers so a restart can reuse completed OCR output and repeat the same upsert safely.
Don't index an identity document merely because the connection works. The safe boundary is a policy decision before the first call.
Verify deletion, then rehearse a rollback that preserves it
Before enabling retention, exercise one discard-only identity case, one approved retained case, and one non-sensitive handout handoff. These are proposed acceptance tests, not reported results. The discard-only case should leave no retained photo or searchable transcript in the application inventory. The retained case should show the deletion obligation immediately, followed by confirmation for each artifact when expiry arrives. The handout case should demonstrate that search admission never inherits permission from an unrelated identity-verification result.
Test the uncomfortable transitions too: scheduling cannot complete, the OCR stage succeeds before the next stage is interrupted, and an upsert receives a rate-limit response. Verify that provisional artifacts remain visible to cleanup, stable identifiers prevent duplicate logical records, and expired material cannot be admitted again by a delayed retry. Observe the queue of obligations until it drains; a successful request acknowledgment alone doesn't establish deletion completion.
Rollback should stop new retention and new indexing while keeping expiry enforcement running. Return verification traffic to the approved discard-only path where the product permits it, quarantine ambiguous artifacts, and reconcile the existing inventory before reopening admission. Don't restore expired identity photos as a side effect of restoring application state.
The decision is then concrete: retain only for a named purpose and interval, prove moderation coverage for images intended to be served, and let capacity planning expose the operational cost of every extra day. The smallest useful identity record is easier to govern than a growing collection of optimized photos.
References
- GDPR legal text, including Article 5 principles: https://eur-lex.europa.eu/eli/reg/2016/679/oj
- MDN image file type and format guide: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
- Cloudinary documentation: https://cloudinary.com/documentation
- imgix documentation: https://docs.imgix.com/
- ImageKit documentation: https://imagekit.io/docs/
- Amazon Textract documentation: https://docs.aws.amazon.com/textract/
- Tesseract documentation: https://tesseract-ocr.github.io/tessdoc/
- Pinecone documentation: https://docs.pinecone.io/

