You are viewing beta documentation for Formie 4.x.
GraphQL

Query Submissions

Formie submissions are Craft elements, so GraphQL submission queries follow the same general pattern as other element queries. Use formieSubmission when you need one submission, formieSubmissions when you need a list, and formieSubmissionCount when you only need the total.

{
    formieSubmissions(form: "contactForm", limit: 10) {
        title
        status
        isIncomplete
        isSpam

        ... on contactForm_Submission {
            yourName
            emailAddress
            message
        }
    }
}

Submission Queries

The submission queries accept Craft’s standard element query arguments, Formie’s submission-specific arguments, and field-handle arguments for the fields in forms that are available to the active GraphQL schema.

ArgumentTypeDescription
form[String]Narrows results by form handle.
statusStringNarrows results by submission status.
statusIdIntNarrows results by submission status ID.
siteIdIntNarrows results by site ID.
isIncompleteBooleanNarrows results by incomplete state.
isSpamBooleanNarrows results by spam state.
id[QueryArgument]Narrows results by element ID.
uid[String]Narrows results by UID.
title[String]Narrows results by title.
searchStringNarrows results by a search query.
dateCreated[String]Narrows results by creation date.
dateUpdated[String]Narrows results by last-updated date.
offsetIntSets the offset for paginated results.
limitIntSets the result limit.
orderByStringSets the sort order.
fixedOrderBooleanReturns results in the order provided by the id argument.
inReverseBooleanReverses the result order.
archivedBooleanNarrows results to archived elements.
trashedBooleanNarrows results to soft-deleted elements.
uniqueBooleanReturns only elements with unique IDs.

You can also query by field handle, similar to querying other Craft elements by custom field content.

Field-handle filters are only supported when the form argument targets exactly one form handle. Cross-form queries should stick to the generic submission arguments such as form, status, siteId, isIncomplete, and isSpam.

If you see an error like Field handle filters on submission queries require the form argument to target exactly one form., it means the query is using one or more field-handle filters without narrowing form to a single handle.

{
    formieSubmissions(form: "contactForm", emailAddress: "[email protected]") {
        title
    }
}

But this is not, because field-handle filters become ambiguous across multiple forms:

{
    formieSubmissions(form: ["contactForm", "supportForm"], emailAddress: "[email protected]") {
        title
    }
}

Submission Fields

Every submission implements SubmissionInterface. The fields available inside the inline fragment depend on the form’s field layout.

FieldTypeDescription
statusStringThe submission status handle.
statusIdIntThe submission status ID.
ipAddressStringThe submission IP address.
isIncompleteBooleanWhether the submission is incomplete.
isSpamBooleanWhether the submission is marked as spam.
spamReasonStringThe submission’s spam reason.
spamClassStringThe spam check or class that marked the submission as spam.

Use an inline fragment for the form-specific submission type when you need field content.

When you query submissions without field-handle filters, Formie can infer the form context from a single inline fragment such as ... on contactForm_Submission. That is enough for selecting field content, but it does not replace the explicit form requirement for field-handle query arguments. If you mix multiple different submission fragments in one selection, the query should also include an explicit form filter so the intent is unambiguous.

{
    formieSubmission(id: 123) {
        title

        ... on contactForm_Submission {
            yourName
            emailAddress
            message
        }
    }
}

Nested Field Content

Group and Repeater fields return structured content. The exact field names depend on your nested fields.

{
    formieSubmissions(form: "contactForm") {
        title

        ... on contactForm_Submission {
            groupFieldHandle {
                myFieldHandle
            }

            repeaterFieldHandle {
                rows {
                    myFieldHandle
                }
            }
        }
    }
}

For a quick way to discover the correct output types for a form’s fields, query the form’s field layout and include each field’s typeName and inputTypeName.