Skip to content

GraphQL API

This page lists every PAC-relevant GraphQL operation. The schema itself lives in schema.graphql (public) and admin.graphql (admin).

Tenant-facing mutations

Invoice

app/graphql/invoices/mutations/invoice_mutations.py

Mutation Purpose
generateInvoice(orderId, invoiceGenerationMode) Build an invoice from an existing order. If mode is DGI, submits to PAC.
createInvoice(invoice) Create an invoice from scratch.
updateInvoice(invoice) Update a draft. Re-validates retention.
voidInvoice(invoiceId, reason) Void an authorized invoice. See Voiding.
resendInvoiceEmail(invoiceId, email, message) Ask Alanube to email the PDF to a recipient.

Credit

app/graphql/credits/mutations/credit_mutations.py

Mutation Purpose
createCredit(credit) Create + submit a credit note.
voidCredit(creditId, reason) Void a credit.
convertCreditToDgi(creditId) Promote a PROFORM credit to DGI.

Common

app/graphql/common/mutations/pac_mutations.py

Mutation Purpose
attachPacPdf(sourceId, sourceType) Manually fetch and attach the PAC PDF. sourceType is INVOICE or CREDIT_NOTE.

DGI

app/graphql/invoices/mutations/dgi_invoice_mutations.py

Mutation Purpose
createInvoiceFromFile(file, sourceType) Upload a PDF/image of someone else's invoice and parse it via QR/AI. Used for invoice imports (DGI_IMPORT mode).

Tenant-facing queries

app/graphql/dgi/queries/dgi_queries.py

Query Purpose
goodsAndServices Returns the CPBS catalog. Cached for 24h. Use to populate a selector when invoicing government entities.

Admin operations

The admin schema is separate (different endpoint, different permissions).

Admin queries

app/admin/graphql/pac/queries.py

Query Purpose
pacDocumentsReport(tenantId, fromDate, toDate, docType, legalStatus, groupBy) Per-tenant document totals as reported by Alanube.
pacDocumentsReportAllCompanies(fromDate, toDate, legalStatus) Cross-tenant totals. Useful for billing reconciliation.

Admin mutations

app/admin/graphql/pac/mutations.py

Mutation Purpose
createPacCompany(tenantId, rucType, ruc, tradeName, certFile, certPassword, dv, logoUrl) Step 1 of onboarding.
pacCompanyAffiliate(tenantId, affiliationType) Steps 3 and 4 of onboarding.
createPacOffice(tenantId, coordinates, address, telephone, location, code, officeType) Step 5 of onboarding (and any subsequent office additions).

Patterns

A few conventions worth knowing:

  • Mode is always explicit. Never assume DGI. The mutation input takes a generationMode and the resolver branches on it.
  • UNSET for optional fields. We use Strawberry's UNSET sentinel rather than None for optional inputs. See AGENT_CODING_STYLE.md.
  • Admin vs tenant schemas live in separate files. Don't add admin operations to the tenant schema or vice versa.
  • Mutations return the updated entity, not just an ack. Frontend can re-render directly from the response.