Documents.Delete
func (d *Documents) Delete(ctx context.Context, id string, opts ...option.RequestOption) errorDelete soft-deletes a stored document. The PDF is purged from storage; metadata is retained for audit. Deleting an already-deleted document also succeeds: the API answers 204 either way.
Spec §6.4.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
ctx | context.Context | required | (no description) |
id | string | required | (no description) |
opts | ...option.RequestOption | — | (no description) |
Returns
Section titled “Returns”error
Errors
Section titled “Errors”| Code | When |
|---|---|
DOCUMENT_NOT_FOUND | No stored document matches the supplied id. |
ENVIRONMENT_PROTECTED | The environment is protected: this key may not delete its documents. |
INVALID_API_KEY | The API key is malformed or revoked. |
INTERNAL_ERROR | API returned 5xx. Retryable. |
Example
Section titled “Example”// Demonstrates: client.Documents.Delete(ctx, id) — soft-delete a stored document.package main
import ( "context" "fmt" "os"
polipage "github.com/poli-page/sdk-go" "github.com/poli-page/sdk-go/option")
func main() { client := polipage.NewClient( option.WithAPIKey(os.Getenv("POLI_PAGE_API_KEY")), )
if err := client.Documents.Delete(context.Background(), "doc_abc123"); err != nil { panic(err) }
// Returns nil. The PDF is purged; metadata is retained for audit. fmt.Println("Deleted.")}