Forum Discussion
Is there an API to read Microsoft forms data
It appears the URL format of the undocumented Forms API has changed. When I used the examples from earlier posts, they returned a 404. This worked for me:
# Get personal Forms
https://forms.office.com/formapi/api/forms
# Get all Forms for a Microsoft 365 Group
https://forms.office.com/formapi/api/{tenantId}/groups/{groupId}/forms
# Get the details for a group form
https://forms.office.com/formapi/api/{tenantId}/groups/{groupId}/forms('{formId}')
# Get the questions from a group form
https://forms.office.com/formapi/api/{tenantId}/groups/{groupId}/forms('{formId}')/questions
# Get the responses to a group form
https://forms.office.com/formapi/api/{tenantId}/groups/{groupId}/forms('{formId}')/responses
- johndpalmAug 17, 2022Brass Contributor
Here's the Swagger I'm using to run a Power Automate custom connector for the 4 GET requests I mentioned above:
swagger: '2.0' info: title: Default title description: A custom connector for Microsoft Forms API version: '1.0' host: forms.office.com basePath: /formapi/api schemes: - https consumes: [] produces: [] paths: /{Tenant Id}/groups/{Group Id}/forms: get: responses: default: description: default schema: type: object properties: value: type: array items: type: object properties: id: type: string description: id title: '' x-ms-visibility: internal title: type: string description: The title of the form title: Title x-ms-visibility: important thankYouMessage: type: string description: >- The thank you message displayed when completing the form. title: Thank you message x-ms-visibility: important type: type: string description: 'The type of form: form or quiz' title: Type x-ms-visibility: important defaultLanguage: type: string description: defaultLanguage title: '' x-ms-visibility: internal dataClassificationLevel: type: string description: dataClassificationLevel title: '' x-ms-visibility: internal formsProRTTitle: type: string description: formsProRTTitle title: '' x-ms-visibility: internal formsProRTDescription: type: string description: formsProRTDescription title: '' x-ms-visibility: internal meetingId: type: string description: meetingId title: '' x-ms-visibility: internal formsInsightsInfo: type: string description: formsInsightsInfo title: '' x-ms-visibility: internal responseThresholdCount: type: string description: '' title: Response threshold count x-ms-visibility: advanced inviteExpiryDays: type: string description: inviteExpiryDays title: '' x-ms-visibility: internal collectionId: type: string description: collectionId title: '' x-ms-visibility: internal TenantSwitches: type: integer format: int32 description: TenantSwitches title: '' x-ms-visibility: internal PrivacyUrl: type: string description: PrivacyUrl title: '' x-ms-visibility: internal description: type: string description: Form description title: Description x-ms-visibility: important onlineSafetyLevel: type: integer format: int32 description: onlineSafetyLevel title: '' x-ms-visibility: internal reputationTier: type: integer format: int32 description: '' title: Reputation tier x-ms-visibility: advanced tableId: type: string description: tableId title: '' x-ms-visibility: internal otherInfo: type: string description: Other information such as the name of the theme used. title: Other information status: type: string description: The status of the form title: Status x-ms-visibility: important category: type: string description: category title: '' x-ms-visibility: internal predefinedResponses: type: string description: predefinedResponses title: '' x-ms-visibility: internal createdBy: type: string description: The GUID of the user who created the form title: Created by XlFileUnSynced: type: boolean description: XlFileUnSynced title: '' x-ms-visibility: internal enum: - '' - 'true' - 'false' mfpBranchingData: type: string description: mfpBranchingData title: '' x-ms-visibility: internal email address removed for privacy reasons: type: string description: email address removed for privacy reasons title: '' x-ms-visibility: internal rowCount: type: integer format: int32 description: '' title: Row count x-ms-visibility: advanced progressBarEnabled: type: string description: '' title: Progress bar enabled x-ms-visibility: advanced trackingId: type: string description: '' title: Tracking Id x-ms-visibility: advanced xlWorkbookId: type: string description: xlWorkbookId title: '' x-ms-visibility: internal xlTableId: type: string description: xlTableId title: '' x-ms-visibility: internal xlExportingTag: type: string properties: Status: type: string description: Status title: '' x-ms-visibility: internal ExportedRowCount: type: integer format: int32 description: ExportedRowCount title: '' x-ms-visibility: internal description: xlExportingTag ShareToken: type: string description: ShareToken title: '' x-ms-visibility: internal localeList: type: array items: {} description: localeList logo: type: object properties: altText: type: string description: altText title: '' x-ms-visibility: internal contentType: type: string description: contentType title: '' x-ms-visibility: internal fileIdentifier: type: string description: fileIdentifier title: '' x-ms-visibility: internal height: type: string description: height title: '' x-ms-visibility: internal originalFileName: type: string description: originalFileName title: '' x-ms-visibility: internal resourceId: type: string description: resourceId title: '' x-ms-visibility: internal resourceUrl: type: string description: resourceUrl title: '' x-ms-visibility: internal width: type: string description: width title: '' x-ms-visibility: internal size: type: string description: size title: '' x-ms-visibility: internal description: logo header: type: object properties: altText: type: string description: altText title: '' x-ms-visibility: internal contentType: type: string description: contentType title: '' x-ms-visibility: internal fileIdentifier: type: string description: fileIdentifier title: '' x-ms-visibility: internal height: type: string description: height title: '' x-ms-visibility: internal originalFileName: type: string description: originalFileName title: '' x-ms-visibility: internal resourceId: type: string description: resourceId title: '' x-ms-visibility: internal resourceUrl: type: string description: resourceUrl title: '' x-ms-visibility: internal width: type: string description: width title: '' x-ms-visibility: internal size: type: string description: size title: '' x-ms-visibility: internal description: header background: type: object properties: altText: type: string description: altText title: '' x-ms-visibility: internal contentType: type: string description: contentType title: '' x-ms-visibility: internal fileIdentifier: type: string description: fileIdentifier title: '' x-ms-visibility: internal height: type: string description: height title: '' x-ms-visibility: internal originalFileName: type: string description: originalFileName title: '' x-ms-visibility: internal resourceId: type: string description: resourceId title: '' x-ms-visibility: internal resourceUrl: type: string description: resourceUrl title: '' x-ms-visibility: internal width: type: string description: width title: '' x-ms-visibility: internal size: type: string description: size title: '' x-ms-visibility: internal description: background FileUploadFormInfo: type: string description: FileUploadFormInfo title: '' x-ms-visibility: internal modifiedDate: type: string description: When the form was last modified title: Modified date createdDate: type: string description: When the form was created title: Created date version: type: string description: The version of the form title: Version ownerId: type: string description: The user GUID of the owner title: Owner Id ownerTenantId: type: string description: ownerTenantId title: Owner tenant Id x-ms-visibility: internal softDeleted: type: integer format: int32 description: softDeleted title: '' x-ms-visibility: internal flags: type: integer format: int32 description: flags title: '' x-ms-visibility: internal emailReceiptEnabled: type: string description: emailReceiptEnabled title: '' x-ms-visibility: internal description: value summary: Get all forms for a group operationId: GetFormsByGroup description: Get all Microsoft Forms for a Microsoft 365 Group parameters: - name: Tenant Id in: path required: true type: string - name: Group Id in: path required: true type: string /{Tenant Id}/groups/{Group Id}/forms('{Form Id}'): get: responses: default: description: default schema: {} summary: Get form details description: Get details about a Microsoft Forms form operationId: GetFormDetails parameters: - name: Tenant Id in: path required: true type: string - name: Group Id in: path required: true type: string - name: Form Id in: path required: true type: string /{Tenant Id}/groups/{Group Id}/forms('{Form Id}')/questions: get: responses: default: description: default schema: type: object properties: '@odata.context': type: string description: '@odata.context' title: '' x-ms-visibility: internal value: type: array items: type: object properties: id: type: string description: id title: Id title: type: string description: title title: Title x-ms-visibility: important order: type: number format: double description: order title: Order type: type: string description: type title: Type x-ms-visibility: important required: type: boolean description: required title: Required enum: - '' - 'true' - 'false' questionInfo: type: string properties: Choices: type: array items: type: object properties: Description: type: string description: Description IsMathOption: type: boolean description: IsMathOption BranchInfo: type: object properties: TargetQuestionId: type: string description: TargetQuestionId ToTheEnd: type: boolean description: ToTheEnd description: BranchInfo IsGenerated: type: boolean description: IsGenerated IsAnswerKey: type: boolean description: IsAnswerKey description: Choices ChoiceType: type: integer format: int32 description: ChoiceType title: Choice type AllowOtherAnswer: type: boolean description: AllowOtherAnswer title: Allow other answer enum: - '' - 'true' - 'false' OptionDisplayStyle: type: string description: OptionDisplayStyle title: Option display style description: questionInfo isQuiz: type: boolean description: isQuiz groupId: type: string description: groupId title: '' x-ms-visibility: internal defaultValue: type: string description: defaultValue title: '' x-ms-visibility: internal modifiedDate: type: string description: modifiedDate title: Modified date status: type: string description: status title: Status subtitle: type: string description: subtitle title: Subtitle allowMultipleValues: type: string description: allowMultipleValues title: '' x-ms-visibility: internal titleHasPhishingKeywords: type: boolean description: titleHasPhishingKeywords title: '' x-ms-visibility: internal enum: - '' - 'true' - 'false' subtitleHasPhishingKeywords: type: boolean description: subtitleHasPhishingKeywords title: '' x-ms-visibility: internal enum: - '' - 'true' - 'false' questionTagForIntelligence: type: string description: questionTagForIntelligence title: '' x-ms-visibility: internal isFromSuggestion: type: boolean description: isFromSuggestion insightsInfo: type: string description: insightsInfo title: '' x-ms-visibility: internal formsProRTQuestionTitle: type: string description: formsProRTQuestionTitle title: '' x-ms-visibility: internal formsProRTSubtitle: type: string description: formsProRTSubtitle title: '' x-ms-visibility: internal allowCustomChoice: type: string description: allowCustomChoice title: '' x-ms-visibility: internal trackingId: type: string description: trackingId title: Tracking Id image: type: object properties: altText: type: string description: altText title: '' x-ms-visibility: internal contentType: type: string description: contentType title: '' x-ms-visibility: internal fileIdentifier: type: string description: fileIdentifier title: '' x-ms-visibility: internal height: type: string description: height title: '' x-ms-visibility: internal originalFileName: type: string description: originalFileName title: '' x-ms-visibility: internal resourceId: type: string description: resourceId title: '' x-ms-visibility: internal resourceUrl: type: string description: resourceUrl title: '' x-ms-visibility: internal width: type: string description: width title: '' x-ms-visibility: internal size: type: string description: size title: '' x-ms-visibility: internal description: image fileUploadSPOInfo: type: string description: fileUploadSPOInfo title: '' x-ms-visibility: internal description: value summary: Get form questions description: Get the questions from a Microsoft Forms form operationId: GetFormQuestions parameters: - name: Tenant Id in: path required: true type: string - name: Group Id in: path required: true type: string - name: Form Id in: path required: true type: string /{Tenant Id}/groups/{Group Id}/forms('{Form Id}')/responses: get: responses: default: description: default schema: type: object properties: '@odata.context': type: string description: '@odata.context' title: '' x-ms-visibility: internal value: type: array items: type: object properties: id: type: integer format: int32 description: id title: Id startDate: type: string description: startDate title: Start date submitDate: type: string description: submitDate title: Submit date responder: type: string description: responder title: Responder responderName: type: string description: responderName title: Responder name answers: type: string items: type: object properties: answer1: type: string description: answer1 questionId: type: string description: questionId description: answers releaseDate: type: string description: releaseDate title: '' x-ms-visibility: internal quizResult: type: string description: quizResult emailReceiptConsent: type: string description: emailReceiptConsent title: '' x-ms-visibility: internal submitLanguage: type: string description: submitLanguage title: '' x-ms-visibility: internal msRewardsData: type: string description: msRewardsData title: '' x-ms-visibility: internal FormsProData: type: string description: FormsProData title: '' x-ms-visibility: internal description: value summary: Get form responses description: Get responses for a Microsoft Forms form operationId: GetFormResponses parameters: - name: Tenant Id in: path required: true type: string - name: Group Id in: path required: true type: string - name: Form Id in: path required: true type: string definitions: {} parameters: {} responses: {} securityDefinitions: oauth2_auth: type: oauth2 flow: accessCode authorizationUrl: https://login.windows.net/common/oauth2/authorize tokenUrl: https://login.windows.net/common/oauth2/authorize scopes: {} security: - oauth2_auth: [] tags: []
- MKringsNov 16, 2022Copper Contributor
Hello, I noticed the change regarding the URL as well. Thank you very much for your information.
As far as I can see the form I want does not belong to a group and therefore I do not have a groupID to work with. Any suggestions on how to get the responses?
(or any suggestions on how to get them as json in another way, as this is my main interest)
- joeskeenDec 01, 2022Copper Contributor
MKrings looking closer at the response by johndpalm here: https://techcommunity.microsoft.com/t5/microsoft-forms/is-there-an-api-to-read-microsoft-forms-data/m-p/3567079/highlight/true#M11500
I was able to figure out how to get personal forms:
# Get personal Forms https://forms.office.com/formapi/api/forms # Get the details for a personal form https://forms.office.com/formapi/api/forms('{formId}') # Get the questions from a personal form https://forms.office.com/formapi/api/forms('{formId}')/questions # Get the responses to a personal form https://forms.office.com/formapi/api/forms('{formId}')/responses