Push App Configuration Files

PATCH /groups/{groupId}/apps/{appId}/push

Upload a new full App configuration. This operation overwrites the entire existing App configuration.

Note: If your App configuration includes any references to a Secret, you must create the Secret before you push the configuration.

Path parameters

application/json

Body

  • name string Required

    The App's name.

  • provider_region string Required

    One of:

    Values are aws-us-east-1, aws-us-west-2, aws-us-east-2, aws-eu-central-1, aws-eu-west-1, aws-eu-west-2, aws-ap-southeast-1, aws-ap-southeast-2, aws-ap-south-1, or aws-sa-east-1.

    Values are azure-eastus2, azure-westus, azure-westeurope, azure-eastasia, or azure-southeastasia.

    Values are gcp-us-central1, gcp-us-east4, gcp-us-west1, gcp-europe-west1, or gcp-asia-south1.

  • deployment_model string Required

    An application deployment model.

    Values are GLOBAL or LOCAL.

  • environment string

    The application's environment.

    Values are development, testing, qa, or production.

  • auth_providers array[object] Required
    Any of:
  • custom_user_data object | null
    Hide custom_user_data attributes Show custom_user_data attributes object | null
    • database_name string

      The name of the database that contains custom user data.

    • collection_name string

      The name of the collection that contains custom user data.

    • user_id_field string

      The name of a field that appears in every custom user data document and that contains the user account ID of each document's corresponding user.

    • enabled boolean

      If true, custom user data is enabled.

    • mongo_service_name string Required

      The name of the linked MongoDB data source that contains custom user data.

    • on_user_creation_function_name string

      The name of a user creation function that runs whenever a new user registers.

  • data_api_config object | null
    Hide data_api_config attributes Show data_api_config attributes object | null
    • disabled boolean Required
    • versions array[string] Required

      A supported version of the Data API.

      Value is v1.

    • return_type string Required

      A data format supported by the Data API & custom endpoints.

      Values are JSON or EJSON.

    • create_user_on_auth boolean
    • run_as_user_id string

      An application user's account ID. If defined, endpoints will always run as the specified user.

    • run_as_user_id_script_source string

      Stringified source code for a function that returns an application user's account ID. If defined, endpoints execute the function on every request and run as the user with the ID returned from the function.

    • validation_method string Required

      Values are NO_VALIDATION, SECRET_AS_QUERY_PARAM, or VERIFY_PAYLOAD.

    • secret_name string

      If validation_method is set to "SECRET_AS_QUERY_PARAM" or "VERIFY_PAYLOAD", this is the name of the Secret that authorizes requests.

    • can_evaluate object

      A JSON expression that evaluates to true if an endpoint is allowed to run in response to an incoming request.

  • data_sources array[object] Required
    One of:
  • endpoints array[object] Required
    Hide endpoints attributes Show endpoints attributes object
    • route string Required
    • http_method string Required

      Values are GET, POST, PUT, PATCH, DELETE, or *.

    • function_id string Required
    • validation_method string Required

      Values are NO_VALIDATION, SECRET_AS_QUERY_PARAM, or VERIFY_PAYLOAD.

    • secret_id string

      If validation_method is set to "SECRET_AS_QUERY_PARAM" or "VERIFY_PAYLOAD", this is the _id of the Secret that authorizes requests.

    • return_type string Required

      A data format supported by the Data API & custom endpoints.

      Values are JSON or EJSON.

    • respond_result boolean Required
    • fetch_custom_user_data boolean
    • create_user_on_auth boolean
    • disabled boolean Required
    • function_name string Required

      The endpoint functions's name.

  • environments object Required
    Hide environments attribute Show environments attribute object
    • values object

      An object that maps each possible environment name to definitions of the environment values available in that environment.

      Hide values attributes Show values attributes object
      • none object
        Hide none attribute Show none attribute object
        • values object
      • development object
        Hide development attribute Show development attribute object
        • values object
      • testing object
        Hide testing attribute Show testing attribute object
        • values object
      • qa object
        Hide qa attribute Show qa attribute object
        • values object
      • production object
        Hide production attribute Show production attribute object
        • values object
  • functions array[object] Required
    Hide functions attributes Show functions attributes object
    • can_evaluate object

      A JSON expression that evaluates to true if the Function is allowed to run in response to an incoming request.

    • name string Required

      A unique name for the Function.

    • private boolean Required

      If true, the function is hidden from client applications. You can still call a private function from JSON expressions and other functions, including incoming webhooks and triggers.

    • source string Required

      The stringified source code for the function. The code must be valid ES6.

    • run_as_system boolean

      If true, the function executes with full privileges, bypassing rules on all services.

    • run_as_user_id string

      An application user's account ID. If defined, endpoints will always run as the specified user. Cannot be used with run_as_user_id_script_source.

    • run_as_user_id_script_source string

      The stringified source code for a function that returns an application user's account ID. If defined, endpoints execute the function on every request and run as the user with the ID returned from the function. Cannot be used with run_as_user_id.

  • graphql object Required
    Hide graphql attributes Show graphql attributes object
    • config object Required
      Hide config attributes Show config attributes object
      • use_natural_pluralization boolean

        If true, generated schema type names use common English pluralization whenever possible.

        If false, or if a natural pluralization cannot be determined, then plural types use the singular type name with an "s" appended to the end.

        You cannot change this value after you create your App. This value is true for all new Apps.

      • disable_schema_introspection boolean

        If true, the GraphQL API blocks introspection queries from clients.

    • validation_settings object Required
      Hide validation_settings attributes Show validation_settings attributes object
      • read_validation_action string

        Values are ERROR or WARN.

      • read_validation_level string

        Values are STRICT or OFF.

      • write_validation_action string

        Values are ERROR or WARN.

      • write_validation_level string

        Values are STRICT or OFF.

    • custom_resolvers array[object] Required
      Hide custom_resolvers attributes Show custom_resolvers attributes object
      • on_type string Required

        The name of the resolver's parent type. This can be "Query", "Mutation", or the name of a generated type if this is a computed property.

      • field_name string Required

        The name of the custom resolver field that appears in the GraphQL schema.

      • input_type string | object

        The type of the custom resolver's input parameter. This can be a scalar, the name of an existing generated type, or a custom JSON schema object. If undefined, the resolver does not accept an input.

      • input_type_format string

        The kind of input type the custom resolver uses. This value must agree with the value of input_type:

        • A scalar input type must use "scalar" or "scalar-list"
        • A generated input type must use "generated" or "generated-list"
        • A custom input type must use "custom"

        If undefined, the resolver does not accept an input.

        Values are scalar, scalar-list, generated, generated-list, or custom.

      • payload_type string | object

        The type of the value returned by the custom resolver. This can be a scalar, the name of an existing generated type, or a custom JSON schema object.

        If undefined, the resolver returns a DefaultPayload object:

        type DefaultPayload {
          status: String!
        }
        
      • payload_type_format string

        The kind of payload type the custom resolver uses. This value must agree with the value of payload_type:

        • A scalar payload type must use "scalar" or "scalar-list"
        • A generated payload type must use "generated" or "generated-list"
        • A custom payload type must use "custom"

        If undefined, the resolver returns a DefaultPayload object.

        Values are scalar, scalar-list, generated, generated-list, or custom.

      • function_name string Required

        The resolver function's name.

  • hosting object Required
    Hide hosting attributes Show hosting attributes object
    • enabled boolean Required
    • custom_domain string
    • default_error_path string
    • default_error_code string
  • https_endpoints array[object] Required

    [Deprecated] A list of legacy HTTP services. This is for backwards compatibility only.

    Hide https_endpoints attributes Show https_endpoints attributes object
    • name string

      The service name.

    • type string

      The type of service.

      Values are aws, twilio, github, gcm, or http.

    • incoming_webhooks array[object]
      Hide incoming_webhooks attributes Show incoming_webhooks attributes object
      • name string Required
      • function_source string Required
      • respond_result boolean Required
      • options object
        Hide options attributes Show options attributes object
        • secret string
        • secretAsQueryParam boolean
    • version integer
  • log_forwarders array[object] Required
    Hide log_forwarders attributes Show log_forwarders attributes object
    • name string Required
    • disabled boolean Required
    • log_types array[string] Required

      Values are auth, endpoint, function, graphql, push, schema, service, sync, trigger, or trigger_error_handler.

    • log_statuses array[string] Required

      Values are error or success.

    • policy object Required
      Hide policy attribute Show policy attribute object
      • type string

        Values are single or batch.

    • action object Required
      Hide action attributes Show action attributes object
      • type string

        Values are collection or function.

      • name string
      • data_source string
      • database string
      • collection string
  • schemas array[object] Required
    Hide schemas attributes Show schemas attributes object
    • metadata object

      Metadata that describes which linked collection the schema applies to.

      Hide metadata attributes Show metadata attributes object
      • data_source string

        The data source name.

      • database string

        The database name.

      • collection string

        The collection name.

    • schema object

      A valid schema for the collection.

      Hide schema attributes Show schema attributes object
      • bsonType string

        The BSON type of the field.

        Values are object, array, string, number, int, long, double, decimal, date, timestamp, bool, null, regex, objectId, binary, uuid, function, javascript, symbol, minKey, or maxKey.

      • title string

        A human-readable title for the schema.

      • required array[string]

        For object schemas, an array of field names that are required in instances of the object.

      • properties object

        An object where each field name is a property in the schema. The corresponding value is a schema definition for that field.

        Hide properties attribute Show properties attribute object
        • * object

          A valid schema for the collection.

    • relationships object

      Relationships to foreign collections. Each field name is a property in the schema. The corresponding value is a relationship definition for that field.

      Hide relationships attribute Show relationships attribute object
      • * object Additional properties

        A relationship definition.

        Hide * attributes Show * attributes object
        • ref string

          A reference string for the foreign collection.

        • foreign_key string

          The name of the field in the foreign collection that the relationship points to.

        • is_list boolean

          If true:

          • the relationship may point to many foreign documents.
          • the local field must be defined as an array in the collection schema.
  • services array[object] Required

    [Deprecated] A list of legacy third-party non-HTTP services. This is for backwards compatibility only.

    Hide services attributes Show services attributes object
    • name string

      The service name.

    • type string

      The type of service.

      Values are aws, twilio, github, gcm, or http.

    • incoming_webhooks array[object]
      Hide incoming_webhooks attributes Show incoming_webhooks attributes object
      • name string Required
      • function_source string Required
      • respond_result boolean Required
      • options object
        Hide options attributes Show options attributes object
        • secret string
        • secretAsQueryParam boolean
    • version integer
  • sync object Required
    Hide sync attributes Show sync attributes object
    • state string Required

      The state of the sync service ("enabled", "disabled", or empty if Sync is not configured).

    • database_name string

      The name of a database in the synced cluster where App Services stores data in Development Mode. App Services automatically generates a schema for each synced type and maps each object type to a collection within the database.

    • queryable_fields_names array[string]

      An array of queryable field names on any collection.

    • indexed_queryable_fields_names array[string]

      A list of field names to use as the indexed queryable field. Although this property is an array, Sync currently supports only one indexed queryable field. Therefore, this array may contain at most one element.

      The indexed queryable field must be present in the schema and be the same eligible field type in every collection you sync. The indexed queryable field name must also appear in queryable_fields_names since this is a global queryable field.

    • collection_queryable_fields_names object

      An array of queryable field names on the specified collection.

      Hide collection_queryable_fields_names attribute Show collection_queryable_fields_names attribute object
      • * object Additional properties
        Hide * attribute Show * attribute object
        • * string Additional properties

          The name of the queryable field.

    • permissions object

      Deprecated

    • last_disabled string

      The last time Sync was disabled, represented by the number of seconds since the UNIX epoch.

    • client_max_offline_days integer

      The number of days the client can be offline before a client reset is required.

    • is_recovery_mode_disabled boolean

      Specifies whether the client reset mode is disabled. By default, client reset mode is enabled and this value is false.

    • asymmetric_tables array[string]

      An array of the names of collections that are defined as asymmetric with Data Ingest, where clients can write data but not read.

  • triggers array[object] Required
    One of:
  • values array[object] Required
    Hide values attributes Show values attributes object
    • name string Required
    • private boolean Required
    • from_secret boolean Required

      If true, the value is a reference by name to a Secret.

Responses

  • 204

    Push successful

  • 400

    Invalid request

  • 500

    Error pulling configuration

PATCH /groups/{groupId}/apps/{appId}/push
curl \
 --request PATCH 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/push' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"name":"string","":"aws-us-east-1","deployment_model":"GLOBAL","environment":"production","auth_providers":[{"name":"anon-user","type":"anon-user","disabled":true}],"custom_user_data":{"database_name":"myapp","collection_name":"users","user_id_field":"user_account_id","enabled":true,"mongo_service_name":"mongodb-atlas","on_user_creation_function_name":"myFunction"},"data_api_config":{"disabled":true,"versions":["v1"],"return_type":"JSON","create_user_on_auth":true,"run_as_user_id":"string","run_as_user_id_script_source":"string","validation_method":"NO_VALIDATION","secret_name":"string","can_evaluate":{}},"data_sources":[{"name":"string","type":"string","config":{"clusterName":"Cluster0","readPreference":"primary","readPreferenceTagSets":["server1"],"wireProtocolEnabled":true},"default_rule":{"roles":[{"document_filters":{"":{}},"name":"string","":{},"fields":{},"additional_fields":{"":{}}}],"filters":[{"name":"string","":{},"query":{},"projection":{"additionalProperty1":0,"additionalProperty2":0}}]},"rules":[{"database":"string","collection":"string","roles":[{"document_filters":{"":{}},"name":"string","":{},"fields":{},"additional_fields":{"":{}}}],"filters":[{"name":"string","":{},"query":{},"projection":{"additionalProperty1":0,"additionalProperty2":0}}]}]}],"endpoints":[{"route":"string","http_method":"GET","function_id":"string","validation_method":"NO_VALIDATION","secret_id":"string","return_type":"JSON","respond_result":true,"fetch_custom_user_data":true,"create_user_on_auth":true,"disabled":true,"function_name":"string"}],"environments":{"values":{"none":{"values":{}},"development":{"values":{}},"testing":{"values":{}},"qa":{"values":{}},"production":{"values":{}}}},"functions":[{"can_evaluate":{},"name":"string","private":true,"source":"string","run_as_system":true,"run_as_user_id":"string","run_as_user_id_script_source":"string"}],"graphql":{"config":{"use_natural_pluralization":true,"disable_schema_introspection":true},"validation_settings":{"read_validation_action":"ERROR","read_validation_level":"STRICT","write_validation_action":"ERROR","write_validation_level":"STRICT"},"custom_resolvers":[{"on_type":"string","field_name":"string","input_type":"string","input_type_format":"scalar","payload_type":"string","payload_type_format":"scalar","function_name":"string"}]},"hosting":{"enabled":true,"custom_domain":"example.com","default_error_path":"/404.html","default_error_code":"404"},"https_endpoints":[{"name":"string","type":"aws","incoming_webhooks":[{"name":"string","function_source":"string","respond_result":true,"options":{"secret":"string","secretAsQueryParam":true}}],"version":42}],"log_forwarders":[{"name":"string","disabled":true,"log_types":["auth"],"log_statuses":["error"],"policy":{"type":"single"},"action":{"type":"collection","name":"string","data_source":"string","database":"string","collection":"string"}}],"schemas":[{"metadata":{"data_source":"string","database":"string","collection":"string"},"schema":{"bsonType":"object","title":"string","required":["string"],"properties":{"*":{}}},"relationships":{"additionalProperty1":{"ref":"string","foreign_key":"string","is_list":true},"additionalProperty2":{"ref":"string","foreign_key":"string","is_list":true}}}],"services":[{"name":"string","type":"aws","incoming_webhooks":[{"name":"string","function_source":"string","respond_result":true,"options":{"secret":"string","secretAsQueryParam":true}}],"version":42}],"sync":{"state":"string","database_name":"string","queryable_fields_names":["string"],"indexed_queryable_fields_names":["string"],"collection_queryable_fields_names":{"additionalProperty1":{"additionalProperty1":"string","additionalProperty2":"string"},"additionalProperty2":{"additionalProperty1":"string","additionalProperty2":"string"}},"permissions":{},"last_disabled":"string","client_max_offline_days":42,"is_recovery_mode_disabled":true,"asymmetric_tables":["string"]},"triggers":[{"name":"onNewEmployee","type":"DATABASE","config":{"match":{},"project":{},"database":"HR","collection":"employees","service_id":"5adeb649b8b998486770ae7c","full_document":true,"operation_types":["INSERT"]},"function_id":"5eea9ca4ca0e356e2c2a148a","event_processors":{"FUNCTION":{"config":{"function_id":"6841b8d3e71dc81bed89dbba","function_name":"Atlas_Triggers_DatabaseInsert_1749137618"}}}}],"values":[{"name":"string","private":true,"from_secret":true}]}'
Request examples
{
  "name": "string",
  "": "aws-us-east-1",
  "deployment_model": "GLOBAL",
  "environment": "production",
  "auth_providers": [
    {
      "name": "anon-user",
      "type": "anon-user",
      "disabled": true
    }
  ],
  "custom_user_data": {
    "database_name": "myapp",
    "collection_name": "users",
    "user_id_field": "user_account_id",
    "enabled": true,
    "mongo_service_name": "mongodb-atlas",
    "on_user_creation_function_name": "myFunction"
  },
  "data_api_config": {
    "disabled": true,
    "versions": [
      "v1"
    ],
    "return_type": "JSON",
    "create_user_on_auth": true,
    "run_as_user_id": "string",
    "run_as_user_id_script_source": "string",
    "validation_method": "NO_VALIDATION",
    "secret_name": "string",
    "can_evaluate": {}
  },
  "data_sources": [
    {
      "name": "string",
      "type": "string",
      "config": {
        "clusterName": "Cluster0",
        "readPreference": "primary",
        "readPreferenceTagSets": [
          "server1"
        ],
        "wireProtocolEnabled": true
      },
      "default_rule": {
        "roles": [
          {
            "document_filters": {
              "": {}
            },
            "name": "string",
            "": {},
            "fields": {},
            "additional_fields": {
              "": {}
            }
          }
        ],
        "filters": [
          {
            "name": "string",
            "": {},
            "query": {},
            "projection": {
              "additionalProperty1": 0,
              "additionalProperty2": 0
            }
          }
        ]
      },
      "rules": [
        {
          "database": "string",
          "collection": "string",
          "roles": [
            {
              "document_filters": {
                "": {}
              },
              "name": "string",
              "": {},
              "fields": {},
              "additional_fields": {
                "": {}
              }
            }
          ],
          "filters": [
            {
              "name": "string",
              "": {},
              "query": {},
              "projection": {
                "additionalProperty1": 0,
                "additionalProperty2": 0
              }
            }
          ]
        }
      ]
    }
  ],
  "endpoints": [
    {
      "route": "string",
      "http_method": "GET",
      "function_id": "string",
      "validation_method": "NO_VALIDATION",
      "secret_id": "string",
      "return_type": "JSON",
      "respond_result": true,
      "fetch_custom_user_data": true,
      "create_user_on_auth": true,
      "disabled": true,
      "function_name": "string"
    }
  ],
  "environments": {
    "values": {
      "none": {
        "values": {}
      },
      "development": {
        "values": {}
      },
      "testing": {
        "values": {}
      },
      "qa": {
        "values": {}
      },
      "production": {
        "values": {}
      }
    }
  },
  "functions": [
    {
      "can_evaluate": {},
      "name": "string",
      "private": true,
      "source": "string",
      "run_as_system": true,
      "run_as_user_id": "string",
      "run_as_user_id_script_source": "string"
    }
  ],
  "graphql": {
    "config": {
      "use_natural_pluralization": true,
      "disable_schema_introspection": true
    },
    "validation_settings": {
      "read_validation_action": "ERROR",
      "read_validation_level": "STRICT",
      "write_validation_action": "ERROR",
      "write_validation_level": "STRICT"
    },
    "custom_resolvers": [
      {
        "on_type": "string",
        "field_name": "string",
        "input_type": "string",
        "input_type_format": "scalar",
        "payload_type": "string",
        "payload_type_format": "scalar",
        "function_name": "string"
      }
    ]
  },
  "hosting": {
    "enabled": true,
    "custom_domain": "example.com",
    "default_error_path": "/404.html",
    "default_error_code": "404"
  },
  "https_endpoints": [
    {
      "name": "string",
      "type": "aws",
      "incoming_webhooks": [
        {
          "name": "string",
          "function_source": "string",
          "respond_result": true,
          "options": {
            "secret": "string",
            "secretAsQueryParam": true
          }
        }
      ],
      "version": 42
    }
  ],
  "log_forwarders": [
    {
      "name": "string",
      "disabled": true,
      "log_types": [
        "auth"
      ],
      "log_statuses": [
        "error"
      ],
      "policy": {
        "type": "single"
      },
      "action": {
        "type": "collection",
        "name": "string",
        "data_source": "string",
        "database": "string",
        "collection": "string"
      }
    }
  ],
  "schemas": [
    {
      "metadata": {
        "data_source": "string",
        "database": "string",
        "collection": "string"
      },
      "schema": {
        "bsonType": "object",
        "title": "string",
        "required": [
          "string"
        ],
        "properties": {
          "*": {}
        }
      },
      "relationships": {
        "additionalProperty1": {
          "ref": "string",
          "foreign_key": "string",
          "is_list": true
        },
        "additionalProperty2": {
          "ref": "string",
          "foreign_key": "string",
          "is_list": true
        }
      }
    }
  ],
  "services": [
    {
      "name": "string",
      "type": "aws",
      "incoming_webhooks": [
        {
          "name": "string",
          "function_source": "string",
          "respond_result": true,
          "options": {
            "secret": "string",
            "secretAsQueryParam": true
          }
        }
      ],
      "version": 42
    }
  ],
  "sync": {
    "state": "string",
    "database_name": "string",
    "queryable_fields_names": [
      "string"
    ],
    "indexed_queryable_fields_names": [
      "string"
    ],
    "collection_queryable_fields_names": {
      "additionalProperty1": {
        "additionalProperty1": "string",
        "additionalProperty2": "string"
      },
      "additionalProperty2": {
        "additionalProperty1": "string",
        "additionalProperty2": "string"
      }
    },
    "permissions": {},
    "last_disabled": "string",
    "client_max_offline_days": 42,
    "is_recovery_mode_disabled": true,
    "asymmetric_tables": [
      "string"
    ]
  },
  "triggers": [
    {
      "name": "onNewEmployee",
      "type": "DATABASE",
      "config": {
        "match": {},
        "project": {},
        "database": "HR",
        "collection": "employees",
        "service_id": "5adeb649b8b998486770ae7c",
        "full_document": true,
        "operation_types": [
          "INSERT"
        ]
      },
      "function_id": "5eea9ca4ca0e356e2c2a148a",
      "event_processors": {
        "FUNCTION": {
          "config": {
            "function_id": "6841b8d3e71dc81bed89dbba",
            "function_name": "Atlas_Triggers_DatabaseInsert_1749137618"
          }
        }
      }
    }
  ],
  "values": [
    {
      "name": "string",
      "private": true,
      "from_secret": true
    }
  ]
}