# Surveys

## Get all surveys

> Returns all surveys for the organization.\
> \
> \*\*Rate limit:\*\* 60 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"GetSurveysResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/Survey"},"type":"array"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Survey":{"properties":{"id":{"description":"The unique identifier of the survey.","type":"string"},"name":{"description":"The name of the survey.","type":"string"},"type":{"description":"The type of the survey.\n\n`nps`: Represents an NPS survey.\n\n`csat`: Represents a CSAT survey.\n\n`custom`: Represents a custom survey.","enum":["nps","csat","custom"],"type":"string"},"updated_at":{"description":"When the survey was last updated (RFC3339 format).","type":"string"}},"title":"Survey represents a survey in the API response.","type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/surveys":{"get":{"description":"Returns all surveys for the organization.\n\n**Rate limit:** 60 requests per minute","operationId":"GetSurveys","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetSurveysResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Get all surveys","tags":["surveys"]}}}}
```

## Get a survey by its ID

> Returns a single survey by ID.\
> \
> \*\*Rate limit:\*\* 60 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"GetSurveyResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/Survey"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Survey":{"properties":{"id":{"description":"The unique identifier of the survey.","type":"string"},"name":{"description":"The name of the survey.","type":"string"},"type":{"description":"The type of the survey.\n\n`nps`: Represents an NPS survey.\n\n`csat`: Represents a CSAT survey.\n\n`custom`: Represents a custom survey.","enum":["nps","csat","custom"],"type":"string"},"updated_at":{"description":"When the survey was last updated (RFC3339 format).","type":"string"}},"title":"Survey represents a survey in the API response.","type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/surveys/{id}":{"get":{"description":"Returns a single survey by ID.\n\n**Rate limit:** 60 requests per minute","operationId":"GetSurvey","parameters":[{"description":"The ID of the survey.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetSurveyResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Get a survey by its ID","tags":["surveys"]}}}}
```

## Get survey responses for a survey

> Returns paginated survey responses, optionally filtered by time range, account, or contact.\
> \
> \*\*Rate limit:\*\* 60 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"GetSurveyResponsesResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/SurveyResponse"},"type":"array"},"pagination":{"$ref":"#/components/schemas/Pagination"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"SurveyResponse":{"properties":{"account_id":{"description":"The ID of the account associated with the response.","type":"string"},"answers":{"description":"The answers submitted in this response.","items":{"$ref":"#/components/schemas/SurveyResponseAnswer"},"type":"array"},"contact_id":{"description":"The ID of the contact who submitted the response.","type":"string"},"id":{"description":"The unique identifier of the survey response.","type":"string"},"submitted_at":{"description":"When the response was submitted.","format":"date-time","type":"string"}},"title":"SurveyResponse represents a survey response in the API.","type":"object"},"SurveyResponseAnswer":{"properties":{"prompt":{"description":"The prompt/question that was answered.","type":"string"},"question_type":{"description":"The type of question (score or comment).","type":"string"},"value":{"description":"The value of the answer.","type":"string"}},"title":"SurveyResponseAnswer represents an answer in a survey response.","type":"object"},"Pagination":{"properties":{"cursor":{"description":"The cursor for the next page of results.","type":"string"},"has_next_page":{"description":"Indicates if there is a next page of results.","type":"boolean"}},"required":["cursor","has_next_page"],"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/surveys/{id}/responses":{"get":{"description":"Returns paginated survey responses, optionally filtered by time range, account, or contact.\n\n**Rate limit:** 60 requests per minute","operationId":"GetSurveyResponses","parameters":[{"description":"The ID of the survey.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"Filter responses submitted after this time (RFC3339 format).","in":"query","name":"submitted_after","schema":{"type":"string"}},{"description":"Filter responses submitted before this time (RFC3339 format).","in":"query","name":"submitted_before","schema":{"type":"string"}},{"description":"Filter responses by account ID.","in":"query","name":"account_id","schema":{"type":"string"}},{"description":"Filter responses by contact ID.","in":"query","name":"contact_id","schema":{"type":"string"}},{"description":"The cursor for pagination.","in":"query","name":"cursor","schema":{"type":"string"}},{"description":"The number of responses to fetch. Defaults to 100. Must be greater than 0 and less than 1000.","in":"query","name":"limit","schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetSurveyResponsesResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Get survey responses for a survey","tags":["surveys"]}}}}
```

## Search for surveys by a given filter

> Currently, the following fields are filterable for surveys:\
> \
> \* updated\_at (in RFC3339 format). Allowed operators: \`time\_is\_after\`, \`time\_is\_before\`, \`time\_range\`\
> \
> \*\*Rate limit:\*\* 20 requests per minute

```json
{"openapi":"3.0.1","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"SearchSurveysRequest":{"properties":{"filter":{"$ref":"#/components/schemas/Filter"},"limit":{"description":"The number of surveys to fetch. Defaults to 100. Must be greater than 0 and less than 1000.","format":"int64","type":"integer"}},"type":"object"},"Filter":{"properties":{"field":{"description":"The field for this filter.  For allowed fields, see the documentation for\n\nthe specific endpoint you are using.\n\nFor non-compound filters (any operators other than \"and\" or \"or\"),\n\nField must be set, along with either Value or Values, depending on the operator.","type":"string"},"operator":{"description":"The operator for this filter.\n\n`equals`: Matches objects that are exactly equal to the value in the field.\n\n`not_equals`: Matches objects that are not exactly equal to the value in the field.\n\n`contains`: For a multi-valued field, such as tags, this operator will match  objects that contain any of the values in the field.\n\n`does_not_contain`: For a multi-valued field, such as tags, this operator will match  objects that do not contain any of the values in the field.\n\n`in`: Matches objects if the field is one of several possible values,  as specified in the values array.\n\n`not_in`: Matches objects if the field is none of several possible values,  as specified in the values array.\n\n`and`: Matches objects only if all subfilters match.\n\n`or`: Matches objects if any subfilter matches.\n\n`time_is_after`: Matches objects if the field is after the given time.\n\n`time_is_before`: Matches objects if the field is before the given time.\n\n`time_range`: Matches objects if the field is between the given times.\n\n`string_contains`: Matches objects if the field contains the given string.\n\n`string_does_not_contain`: Matches objects if the field does not contain the given string.\n\n`is_set`: Matches objects if the field is set.\n\n`is_unset`: Matches objects if the field is unset.\n\n`greater_than`: Matches objects if the numeric field is greater than the given value.\n\n`less_than`: Matches objects if the numeric field is less than the given value.\n\n`greater_than_or_equals`: Matches objects if the numeric field is greater than or equal to the given value.\n\n`less_than_or_equals`: Matches objects if the numeric field is less than or equal to the given value.","enum":["equals","not_equals","contains","does_not_contain","in","not_in","and","or","time_is_after","time_is_before","time_range","string_contains","string_does_not_contain","is_set","is_unset","greater_than","less_than","greater_than_or_equals","less_than_or_equals"],"type":"string"},"subfilters":{"description":"Sub-filters for this filter.  Valid only when operator is \"and\" or \"or\".\n\nThe maximum allowed depth for a tree of filters is 3.","items":{"$ref":"#/components/schemas/Filter"},"type":"array"},"value":{"description":"The value for this filter. Only used for single-valued operators\n\n(\"equals\", \"not_equals\", \"contains\", \"does_not_contain\")","type":"string"},"values":{"description":"The values for this filter. Only used for multi-valued operators (\"in\", \"not_in\").","items":{"type":"string"},"type":"array"}},"required":["field","operator"],"type":"object"},"SearchSurveysResponseBody":{"properties":{"data":{"items":{"$ref":"#/components/schemas/Survey"},"type":"array"},"request_id":{"type":"string"}},"type":"object"},"Survey":{"properties":{"id":{"description":"The unique identifier of the survey.","type":"string"},"name":{"description":"The name of the survey.","type":"string"},"type":{"description":"The type of the survey.\n\n`nps`: Represents an NPS survey.\n\n`csat`: Represents a CSAT survey.\n\n`custom`: Represents a custom survey.","enum":["nps","csat","custom"],"type":"string"},"updated_at":{"description":"When the survey was last updated (RFC3339 format).","type":"string"}},"title":"Survey represents a survey in the API response.","type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/surveys/search":{"post":{"description":"Currently, the following fields are filterable for surveys:\n\n* updated_at (in RFC3339 format). Allowed operators: `time_is_after`, `time_is_before`, `time_range`\n\n**Rate limit:** 20 requests per minute","operationId":"SearchSurveys","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchSurveysRequest"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchSurveysResponseBody"}}},"description":""},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""}},"summary":"Search for surveys by a given filter","tags":["surveys"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usepylon.com/pylon-docs/developer/api/api-reference/surveys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
