> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Replace a collection's data

PUT https://api.getpostman.com/collections/{collectionId}
Content-Type: application/json

Replaces the contents of a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html). Include the collection's ID values in the request body. If you do not, the endpoint removes the existing items and creates new items.

- To perform an update asynchronously, use the `Prefer` header with the `respond-async` value. When performing an async update, this endpoint returns a HTTP `202 Accepted` response.
- For a complete list of properties and information, see the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).
- For protocol profile behavior, refer to Postman's [Protocol Profile Behavior documentation](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md).

**Note:**

- The maximum collection size this endpoint accepts cannot exceed 100 MB.
- Use the GET `/collection-updates-tasks/{taskId}` endpoint to get the collection's update status when performing an asynchronous update.
- If you don't include the collection items' ID values from the request body, the endpoint **removes** the existing items and recreates the items with new ID values.
- To copy another collection's contents to the given collection, remove all ID values before you pass it in this endpoint. If you do not, this endpoint returns an error. These values include the `id`, `uid`, and `postman_id` values.


Reference: https://learning.postman.com/api-docs/api-reference/collections/put-collection

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /collections/{collectionId}:
    put:
      operationId: putCollection
      summary: Replace a collection's data
      description: >
        Replaces the contents of a collection using the [Postman Collection
        v2.1.0 schema
        format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).
        Include the collection's ID values in the request body. If you do not,
        the endpoint removes the existing items and creates new items.


        - To perform an update asynchronously, use the `Prefer` header with the
        `respond-async` value. When performing an async update, this endpoint
        returns a HTTP `202 Accepted` response.

        - For a complete list of properties and information, see the [Postman
        Collection Format
        documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).

        - For protocol profile behavior, refer to Postman's [Protocol Profile
        Behavior
        documentation](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md).


        **Note:**


        - The maximum collection size this endpoint accepts cannot exceed 100
        MB.

        - Use the GET `/collection-updates-tasks/{taskId}` endpoint to get the
        collection's update status when performing an asynchronous update.

        - If you don't include the collection items' ID values from the request
        body, the endpoint **removes** the existing items and recreates the
        items with new ID values.

        - To copy another collection's contents to the given collection, remove
        all ID values before you pass it in this endpoint. If you do not, this
        endpoint returns an error. These values include the `id`, `uid`, and
        `postman_id` values.
      tags:
        - collections
      parameters:
        - name: collectionId
          in: path
          description: The collection's ID.
          required: true
          schema:
            $ref: '#/components/schemas/collectionId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
        - name: Prefer
          in: header
          description: The `respond-async` header to perform the update asynchronously.
          required: false
          schema:
            $ref: '#/components/schemas/Prefer'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/putCollectionResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PutCollectionRequestBadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PutCollectionRequestUnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PutCollectionRequestForbiddenError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PutCollectionRequestNotFoundError'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PutCollectionRequestInternalServerError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putCollection'
servers:
  - url: https://api.getpostman.com
    description: https://api.getpostman.com
  - url: https://api.eu.postman.com
    description: https://api.eu.postman.com
components:
  schemas:
    collectionId:
      type: string
      title: collectionId
    Prefer:
      type: string
      enum:
        - respond-async
      title: Prefer
    Info2Schema:
      type: string
      enum:
        - https://schema.getpostman.com/json/collection/v2.1.0/collection.json
      description: >-
        The
        "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
        Postman Collection Format v2.1.0 schema.
      title: Info2Schema
    info-2:
      type: object
      properties:
        name:
          type: string
          description: The collection's name.
        _postman_id:
          type: string
          description: >-
            The collection's Postman ID. This field exists for Postman
            Collection Format v1 compatibility.
        description:
          type: string
          description: The collection's description.
        schema:
          $ref: '#/components/schemas/Info2Schema'
          description: >-
            The
            "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
            Postman Collection Format v2.1.0 schema.
        updatedAt:
          type: string
          format: date-time
          description: The date and time when the collection was last updated.
        createdat:
          type: string
          format: date-time
          description: The date and time when the collection was created.
        lastUpdatedBy:
          type: string
          description: The user ID of the person who last updated the collection.
        uid:
          type: string
          format: uid
          description: The collection's unique ID.
      required:
        - name
        - schema
      description: Information about the collection.
      title: info-2
    Variable2Value:
      oneOf:
        - type: string
        - type: boolean
        - type: integer
      description: The key's value.
      title: Variable2Value
    variable-2:
      type: object
      properties:
        id:
          type: string
          description: The variable's ID. Doesn't apply to collection-level variables.
        key:
          type: string
          description: The variable's key (name).
        description:
          type: string
          description: The variable's description.
        value:
          $ref: '#/components/schemas/Variable2Value'
          description: The key's value.
        disabled:
          type: boolean
          default: false
          description: >-
            If true, the variable is not enabled. Doesn't apply to path
            parameter variables.
      description: Information about the variable.
      title: variable-2
    variable-list-2:
      type: array
      items:
        $ref: '#/components/schemas/variable-2'
      description: >-
        A list of the collection's
        [variables](https://learning.postman.com/docs/sending-requests/variables/variables/).
        Make certain not to include sensitive information in variables.
      title: variable-list-2
    Event2Listen:
      type: string
      enum:
        - test
        - prerequest
      description: The `prerequest` (pre-request) or `test` (post-response) value.
      title: Event2Listen
    script-2:
      type: object
      properties:
        id:
          type: string
          description: The script's ID.
        type:
          type: string
          description: The type of script. For example, `text/javascript`.
        exec:
          type: array
          items:
            type: string
          description: >-
            A list of script strings, where each line represents a line of code.
            Separate lines makes it easy to track script changes.
      description: >-
        Information about the Javascript code that can be used to to perform
        setup or teardown operations in a response.
      title: script-2
    event-2:
      type: object
      properties:
        id:
          type: string
          description: The event's ID.
        listen:
          $ref: '#/components/schemas/Event2Listen'
          description: The `prerequest` (pre-request) or `test` (post-response) value.
        script:
          $ref: '#/components/schemas/script-2'
      required:
        - listen
      description: Information about the collection's events.
      title: event-2
    event-list-2:
      type: array
      items:
        $ref: '#/components/schemas/event-2'
      description: >-
        A list of scripts configured to run when specific events occur. These
        scripts can be referenced in the collection by their ID.
      title: event-list-2
    UrlOneOf1QueryItems:
      type: object
      properties:
        key:
          type:
            - string
            - 'null'
          description: The query parameter's key.
        value:
          type:
            - string
            - 'null'
          description: The key's value.
        disabled:
          type: boolean
          default: false
          description: If true, the query parameter isn't sent with the request.
        description:
          type:
            - string
            - 'null'
          description: The query parameter's description.
      title: UrlOneOf1QueryItems
    Url1:
      type: object
      properties:
        raw:
          type: string
          description: The request's raw URL.
        protocol:
          type: string
          description: The request protocol.
        host:
          type: array
          items:
            type: string
          description: The host's URL.
        path:
          type: array
          items:
            type: string
          description: A list of the URL's path components.
        port:
          type: string
          description: >-
            The URL's port number. An empty value indicates port `80` (http) or
            `443` (https).
        query:
          type: array
          items:
            $ref: '#/components/schemas/UrlOneOf1QueryItems'
          description: >-
            A list of query parameters. These are the query string parts of the
            URL, parsed as separate variables.
      title: Url1
    url:
      oneOf:
        - type: string
          format: url
        - $ref: '#/components/schemas/Url1'
      description: Information about the URL.
      title: url
    Auth2Type:
      type: string
      enum:
        - basic
        - bearer
        - apikey
        - digest
        - oauth1
        - oauth2
        - hawk
        - awsv4
        - ntlm
        - edgegrid
        - jwt
        - asap
      description: The authorization type.
      title: Auth2Type
    AuthAttributeValueOneOf1Items:
      type: object
      properties: {}
      title: AuthAttributeValueOneOf1Items
    AuthAttributeValue1:
      type: array
      items:
        $ref: '#/components/schemas/AuthAttributeValueOneOf1Items'
      title: AuthAttributeValue1
    AuthAttributeValue:
      oneOf:
        - type: string
        - $ref: '#/components/schemas/AuthAttributeValue1'
      description: The key's value.
      title: AuthAttributeValue
    AuthAttributeType:
      type: string
      enum:
        - string
        - boolean
        - number
        - array
        - object
        - any
      description: The value's type.
      title: AuthAttributeType
    auth-attribute:
      type: object
      properties:
        key:
          type: string
          description: The auth method's key value.
        value:
          $ref: '#/components/schemas/AuthAttributeValue'
          description: The key's value.
        type:
          $ref: '#/components/schemas/AuthAttributeType'
          description: The value's type.
      required:
        - key
      description: >-
        Information about the supported Postman [authorization
        type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).
      title: auth-attribute
    auth-2:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/Auth2Type'
          description: The authorization type.
        apikey:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: The API key's authentication information.
        awsv4:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for [AWS
            Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/)
            authentication.
        basic:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for [Basic
            Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).
        bearer:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for [Bearer
            Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token)
            authentication.
        digest:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for
            [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/)
            access authentication.
        edgegrid:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for [Akamai
            Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/)
            authentication.
        hawk:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for
            [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/)
            authentication.
        ntlm:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for
            [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/)
            authentication.
        oauth1:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for
            [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/)
            authentication.
        oauth2:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for
            [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/)
            authentication.
        jwt:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for JWT (JSON Web Token). Includes the `payload`,
            `secret`, `algorithm`, `addTokenTo`, and `headerPrefix` properties.
        asap:
          type: array
          items:
            $ref: '#/components/schemas/auth-attribute'
          description: >-
            The attributes for ASAP (Atlassian S2S Authentication Protocol).
            Includes the `kid`, `aud`, `iss`, `alg`, `privateKey`, and `claims`
            properties.
      required:
        - type
      description: >-
        The [authorization type supported by
        Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).
      title: auth-2
    header-2:
      type: object
      properties:
        key:
          type: string
          description: The header's key, such as `Content-Type` or `X-Custom-Header`.
        value:
          type: string
          description: The header key's value.
        description:
          type:
            - string
            - 'null'
          description: The header's description.
      required:
        - key
        - value
      description: Information about the header.
      title: header-2
    header-list-2:
      type: array
      items:
        $ref: '#/components/schemas/header-2'
      description: A list of headers.
      title: header-list-2
    Request2BodyMode:
      type: string
      enum:
        - raw
        - urlencoded
        - formdata
        - file
        - graphql
      description: The data associated with the request.
      title: Request2BodyMode
    Request2BodyUrlencodedItems:
      type: object
      properties:
        key:
          type: string
          description: The key value.
        value:
          type: string
          description: The key's value.
        description:
          type:
            - string
            - 'null'
          description: The key's description.
      required:
        - key
      title: Request2BodyUrlencodedItems
    Request2BodyFormdataItemsOneOf0Type:
      type: string
      enum:
        - text
      description: The `text` value.
      title: Request2BodyFormdataItemsOneOf0Type
    Request2BodyFormdataItems0:
      type: object
      properties:
        key:
          type: string
          description: The key value.
        value:
          type: string
          description: The key's value.
        type:
          $ref: '#/components/schemas/Request2BodyFormdataItemsOneOf0Type'
          description: The `text` value.
        contentType:
          type: string
          description: The form-data Content-Type header.
        description:
          type:
            - string
            - 'null'
          description: The key's description.
      title: Request2BodyFormdataItems0
    Request2BodyFormdataItemsOneOf1Src:
      oneOf:
        - type: string
        - type: array
          items:
            type: string
      title: Request2BodyFormdataItemsOneOf1Src
    Request2BodyFormdataItemsOneOf1Type:
      type: string
      enum:
        - file
      description: The `file` value.
      title: Request2BodyFormdataItemsOneOf1Type
    Request2BodyFormdataItems1:
      type: object
      properties:
        key:
          type: string
          description: The key value.
        src:
          $ref: '#/components/schemas/Request2BodyFormdataItemsOneOf1Src'
        type:
          $ref: '#/components/schemas/Request2BodyFormdataItemsOneOf1Type'
          description: The `file` value.
        contentType:
          type: string
          description: The form-data Content-Type header.
        description:
          type:
            - string
            - 'null'
          description: The key's description.
      title: Request2BodyFormdataItems1
    Request2BodyFormdataItems:
      oneOf:
        - $ref: '#/components/schemas/Request2BodyFormdataItems0'
        - $ref: '#/components/schemas/Request2BodyFormdataItems1'
      title: Request2BodyFormdataItems
    Request2BodyFile:
      type: object
      properties:
        src:
          type:
            - string
            - 'null'
          description: >-
            The name of the file to upload (not its path). A null value
            indicates that no file is selected as a part of the request body.
      description: >-
        If the `mode` value is `file`, an object containing the file request
        information.
      title: Request2BodyFile
    Request2BodyGraphql:
      type: object
      properties:
        query:
          type: string
          description: The GraphQL query.
        variables:
          type:
            - string
            - 'null'
          description: The GraphQL query variables, in JSON format.
      description: >-
        If the `mode` value is `graphql`, an object containing the GraphQL
        request information.
      title: Request2BodyGraphql
    Request2BodyOptions:
      type: object
      properties: {}
      description: Additional configurations and options set for various modes.
      title: Request2BodyOptions
    Request2Body:
      type: object
      properties:
        mode:
          $ref: '#/components/schemas/Request2BodyMode'
          description: The data associated with the request.
        raw:
          type: string
          description: If the `mode` value is `raw`, the raw content of the request body.
        urlencoded:
          type: array
          items:
            $ref: '#/components/schemas/Request2BodyUrlencodedItems'
          description: A list of x-www-form-encoded key/value pairs.
        formdata:
          type: array
          items:
            $ref: '#/components/schemas/Request2BodyFormdataItems'
          description: >-
            If the `mode` value is `formdata`, then a list of form-data key/pair
            values.
        file:
          $ref: '#/components/schemas/Request2BodyFile'
          description: >-
            If the `mode` value is `file`, an object containing the file request
            information.
        graphql:
          $ref: '#/components/schemas/Request2BodyGraphql'
          description: >-
            If the `mode` value is `graphql`, an object containing the GraphQL
            request information.
        options:
          $ref: '#/components/schemas/Request2BodyOptions'
          description: Additional configurations and options set for various modes.
      description: Information about the collection's request body.
      title: Request2Body
    request-2:
      type: object
      properties:
        url:
          $ref: '#/components/schemas/url'
        auth:
          $ref: '#/components/schemas/auth-2'
        method:
          type: string
          description: The request's standard HTTP method.
        description:
          type:
            - string
            - 'null'
          description: The request's description.
        header:
          $ref: '#/components/schemas/header-list-2'
        body:
          $ref: '#/components/schemas/Request2Body'
          description: Information about the collection's request body.
      description: Information about the collection request.
      title: request-2
    Response2Header1:
      type: array
      items:
        $ref: '#/components/schemas/header-2'
      description: A list of the request's headers.
      title: Response2Header1
    Response2Header:
      oneOf:
        - type: string
        - $ref: '#/components/schemas/Response2Header1'
      title: Response2Header
    response-2:
      type: object
      properties:
        id:
          type: string
          description: The response's ID.
        originalRequest:
          $ref: '#/components/schemas/request-2'
        responseTime:
          type:
            - number
            - 'null'
          format: double
          description: The time taken by the request to complete. The unit is milliseconds.
        header:
          $ref: '#/components/schemas/Response2Header'
        body:
          type:
            - string
            - 'null'
          description: The raw text of the response.
        status:
          type: string
          description: The response's status.
        code:
          type: integer
          description: The response status code.
        createdAt:
          type: string
          format: date-time
          description: The date and time at which the response was created.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the response was updated.
        uid:
          type: string
          format: uid
          description: The item's unique ID.
      description: Information about the request's response.
      title: response-2
    ProtocolProfileBehaviorDisabledSystemHeaders:
      type: object
      properties:
        cache-control:
          type: boolean
        postman-token:
          type: boolean
        content-type:
          type: boolean
        content-length:
          type: boolean
        accept-encoding:
          type: boolean
        connection:
          type: boolean
        host:
          type: boolean
      description: Disable the system headers which are added implicitly.
      title: ProtocolProfileBehaviorDisabledSystemHeaders
    ProtocolProfileBehaviorProtocolVersion:
      type: string
      enum:
        - http1
        - http2
        - auto
      description: >-
        The HTTP protocol version to use. Supports the `http1`, `http2`, and
        `auto` values.
      title: ProtocolProfileBehaviorProtocolVersion
    protocol-profile-behavior:
      type: object
      properties:
        strictSSL:
          type: boolean
          description: If true, enables certificate verification.
        followRedirects:
          type: boolean
          description: If true, follow HTTP 3xx responses as redirects.
        maxRedirects:
          type: number
          format: double
          description: The maximum number of redirects to follow.
        disableBodyPruning:
          type: boolean
          description: >-
            If true, disables request body pruning for the GET, COPY, HEAD,
            PURGE, and UNLOCK methods.
        disableUrlEncoding:
          type: boolean
          description: >-
            If true, disables the percent encoding of auth, path, query, and
            fragment URL segments.
        disabledSystemHeaders:
          $ref: '#/components/schemas/ProtocolProfileBehaviorDisabledSystemHeaders'
          description: Disable the system headers which are added implicitly.
        insecureHTTPParser:
          type: boolean
          description: >-
            If true, uses an insecure HTTP parser that accepts invalid HTTP
            headers.
        followOriginalHttpMethod:
          type: boolean
          description: >-
            If true, redirects with the original HTTP method. Redirects with the
            GET HTTP method by default.
        followAuthorizationHeader:
          type: boolean
          description: >-
            If true, retains the `authorization` header when a redirect happens
            to a different hostname.
        protocolVersion:
          $ref: '#/components/schemas/ProtocolProfileBehaviorProtocolVersion'
          description: >-
            The HTTP protocol version to use. Supports the `http1`, `http2`, and
            `auto` values.
        removeRefererHeaderOnRedirect:
          type: boolean
          description: If true, removes the `referer` header when a redirect happens.
        tlsPreferServerCiphers:
          type: boolean
          description: >-
            If true, uses the server's cipher suite order instead of the
            client's during negotiation.
        tlsDisabledProtocols:
          type: array
          items:
            type: string
          description: The SSL and TLS protocol versions to disable during negotiation.
        tlsCipherSelection:
          type: array
          items:
            type: string
          description: >-
            The order of cipher suites that the SSL server profile uses to
            establish a secure connection.
      description: >-
        The
        [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/)
        used to alter the [Protocol Profile
        Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md)
        of sending a request.
      title: protocol-profile-behavior
    item-2:
      type: object
      properties:
        id:
          type: string
          description: The collection item's ID.
        name:
          type: string
          description: The item's name.
        description:
          type:
            - string
            - 'null'
          description: The item's description.
        variable:
          $ref: '#/components/schemas/variable-list-2'
        event:
          $ref: '#/components/schemas/event-list-2'
        request:
          $ref: '#/components/schemas/request-2'
        response:
          type: array
          items:
            $ref: '#/components/schemas/response-2'
          description: A list of the collection's responses.
        protocolProfileBehavior:
          $ref: '#/components/schemas/protocol-profile-behavior'
        createdAt:
          type: string
          format: date-time
          description: The date and time at which the collection item was created.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the collection item was updated.
        uid:
          type: string
          format: uid
          description: The collection item's unique ID.
      required:
        - id
      description: Information about the collection request or folder.
      title: item-2
    modifyCollectionSchema:
      type: object
      properties:
        info:
          $ref: '#/components/schemas/info-2'
        item:
          type: array
          items:
            $ref: '#/components/schemas/item-2'
        event:
          $ref: '#/components/schemas/event-list-2'
        variable:
          $ref: '#/components/schemas/variable-list-2'
        auth:
          $ref: '#/components/schemas/auth-2'
        protocolProfileBehavior:
          $ref: '#/components/schemas/protocol-profile-behavior'
      required:
        - info
        - item
      title: modifyCollectionSchema
    putCollection:
      type: object
      properties:
        collection:
          $ref: '#/components/schemas/modifyCollectionSchema'
      title: putCollection
    PutCollectionResponseCollection:
      type: object
      properties:
        id:
          type: string
          description: The collection's ID.
        name:
          type: string
          description: The collection's name.
        uid:
          type: string
          format: uid
          description: The collection's unique ID.
      title: PutCollectionResponseCollection
    putCollectionResponse:
      type: object
      properties:
        collection:
          $ref: '#/components/schemas/PutCollectionResponseCollection'
      title: putCollectionResponse
    CommonErrorNameMessageError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: CommonErrorNameMessageError
    commonErrorNameMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageError'
          description: Information about the error.
      title: commonErrorNameMessage
    CommonErrorTypeTitleDetailStatusType:
      oneOf:
        - type: string
          format: uri-reference
        - type: string
      title: CommonErrorTypeTitleDetailStatusType
    commonErrorTypeTitleDetailStatus:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailStatusType'
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: Information about the error.
        status:
          type: integer
          description: The error's HTTP status code.
      title: commonErrorTypeTitleDetailStatus
    CommonErrorNameMessageDetailsErrorDetails:
      oneOf:
        - type: object
          additionalProperties:
            description: Any type
        - type: array
          items:
            type: string
      description: Information about the error.
      title: CommonErrorNameMessageDetailsErrorDetails
    CommonErrorNameMessageDetailsError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
        details:
          $ref: '#/components/schemas/CommonErrorNameMessageDetailsErrorDetails'
          description: Information about the error.
      title: CommonErrorNameMessageDetailsError
    commonErrorNameMessageDetails:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageDetailsError'
      title: commonErrorNameMessageDetails
    PutCollectionRequestBadRequestError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorNameMessage'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessageDetails'
      title: PutCollectionRequestBadRequestError
    PutCollectionRequestUnauthorizedError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: PutCollectionRequestUnauthorizedError
    PutCollectionRequestForbiddenError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: PutCollectionRequestForbiddenError
    PutCollectionRequestNotFoundError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessageDetails'
      title: PutCollectionRequestNotFoundError
    CommonErrorTypeTitleDetailDetail:
      oneOf:
        - type: string
        - type: object
          additionalProperties:
            description: Any type
      description: Information about the error.
      title: CommonErrorTypeTitleDetailDetail
    commonErrorTypeTitleDetail:
      type: object
      properties:
        type:
          type: string
          description: The type of error.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailDetail'
          description: Information about the error.
      title: commonErrorTypeTitleDetail
    PutCollectionRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: PutCollectionRequestInternalServerError
  securitySchemes:
    PostmanApiKey:
      type: apiKey
      in: header
      name: x-api-key
    scimApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        A valid [SCIM API
        key](https://learning.postman.com/docs/administration/scim-provisioning/scim-provisioning-overview/#generating-scim-api-key)
        for calls to SCIM endpoints.
    basicAuth:
      type: http
      scheme: basic

```

## Examples

### Collection Updated



**Request**

```json
undefined
```

**Response**

```json
{
  "collection": {
    "id": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "name": "Test Collection",
    "uid": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
  }
}
```

**SDK Code**

```python Collection Updated
import requests

url = "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Collection Updated
const url = 'https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2';
const options = {
  method: 'PUT',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Collection Updated
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Collection Updated
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Collection Updated
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Collection Updated
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Collection Updated
using RestSharp;

var client = new RestClient("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Collection Updated
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Collection Updated



**Request**

```json
undefined
```

**Response**

```json
{
  "task": {
    "id": "be15d43c-0ca9-427b-b073-1c4228f32f8d",
    "status": "in-progress"
  }
}
```

**SDK Code**

```python Collection Updated
import requests

url = "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Collection Updated
const url = 'https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2';
const options = {
  method: 'PUT',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Collection Updated
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Collection Updated
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Collection Updated
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Collection Updated
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Collection Updated
using RestSharp;

var client = new RestClient("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Collection Updated
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Replace a Basic Collection's Data



**Request**

```json
{
  "collection": {
    "info": {
      "name": "Test User Collection",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
      "description": "This is a basic test user collection."
    },
    "item": [
      {
        "id": "5e1bef64-8201-489b-b07c-a1723e008594",
        "name": "Get a user",
        "event": [
          {
            "listen": "prerequest",
            "script": {
              "id": "fd554123-3124-444c-a4ab-a2ed3c21b794",
              "type": "text/javascript",
              "exec": [
                "try {",
                "    const response = await pm.sendRequest({",
                "        url: \"https://postman-echo.com/get\",",
                "        method: \"GET\"",
                "    });",
                "",
                "    console.log(response.json());",
                "} catch (err) {",
                "    console.error(err);",
                "}"
              ],
              "packages": {}
            }
          },
          {
            "listen": "test",
            "script": {
              "id": "85a17bb9-3626-4f86-b206-79798e5f8cd7",
              "type": "text/javascript",
              "exec": [
                "pm.test(\"Status code is 200\", function () {",
                "    pm.response.to.have.status(200);",
                "});"
              ],
              "packages": {}
            }
          }
        ],
        "request": {
          "url": {
            "host": [
              "api",
              "getpostman",
              "com"
            ],
            "path": [
              "v1",
              ":userId"
            ],
            "protocol": "http",
            "raw": "http://api.getpostman.com/v1/:userId",
            "variable": [
              {
                "description": "The user ID.",
                "key": "userId",
                "value": "{{userId}}"
              }
            ]
          },
          "method": "GET",
          "description": "Gets information about a user.",
          "header": []
        },
        "response": [
          {
            "id": "da76da3c-c418-4f72-b47a-24c540badd37",
            "originalRequest": {
              "url": {
                "host": [
                  "api",
                  "getpostman",
                  "com"
                ],
                "path": [
                  "v1",
                  ":userId"
                ],
                "protocol": "http",
                "raw": "http://api.getpostman.com/v1/:userId",
                "variable": [
                  {
                    "description": "The user ID.",
                    "key": "userId",
                    "value": "{{userId}}"
                  }
                ]
              },
              "method": "GET",
              "header": []
            },
            "responseTime": null,
            "header": [
              {
                "description": "",
                "key": "Content-Type",
                "type": "text",
                "value": "application/json"
              }
            ],
            "body": "{\n    \"name\": \"Test User\",\n    \"userId\": 12345678\n}",
            "status": "OK",
            "code": 200,
            "uid": "12345678-da76da3c-c418-4f72-b47a-24c540badd37",
            "_postman_previewlanguage": "json",
            "cookie": [],
            "name": "200 OK"
          }
        ],
        "protocolProfileBehavior": {
          "strictSSL": true,
          "disableBodyPruning": true
        },
        "uid": "12345678-5e1bef64-8201-489b-b07c-a1723e008594"
      },
      {
        "id": "496c0ff9-e602-4506-b7dc-00ecd709d5eb",
        "name": "Delete a user",
        "request": {
          "url": {
            "host": [
              "api",
              "getpostman",
              "com"
            ],
            "path": [
              "v1",
              ":userId"
            ],
            "protocol": "http",
            "raw": "http://api.getpostman.com/v1/:userId",
            "variable": [
              {
                "description": "The user ID.",
                "key": "userId",
                "value": "{{userId}}"
              }
            ]
          },
          "method": "DELETE",
          "description": "Deletes a user.",
          "header": []
        },
        "response": [
          {
            "id": "06f9ea8b-55a7-4e8e-ae12-891a050367de",
            "originalRequest": {
              "url": {
                "host": [
                  "api",
                  "getpostman",
                  "com"
                ],
                "path": [
                  "v1",
                  ":userId"
                ],
                "protocol": "http",
                "raw": "http://api.getpostman.com/v1/:userId",
                "variable": [
                  {
                    "description": "The user ID.",
                    "key": "userId",
                    "value": "{{userId}}"
                  }
                ]
              },
              "method": "DELETE",
              "header": []
            },
            "responseTime": null,
            "body": null,
            "status": "No Content",
            "code": 204,
            "uid": "12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de",
            "_postman_previewlanguage": null,
            "cookie": [],
            "name": "204 No Content"
          }
        ],
        "protocolProfileBehavior": {
          "disableBodyPruning": true
        },
        "uid": "12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb"
      }
    ],
    "event": [
      {
        "listen": "prerequest",
        "script": {
          "id": "86cc41c1-a9ad-411f-923d-5f1d15344c94",
          "type": "text/javascript",
          "exec": [
            ""
          ],
          "packages": {}
        }
      },
      {
        "listen": "test",
        "script": {
          "id": "9f48d011-89cb-4a85-9179-b3554aa44aff",
          "type": "text/javascript",
          "exec": [
            "pm.test(\"Content-Type is present\", function () {",
            "    pm.response.to.have.header(\"Content-Type\");",
            "});"
          ],
          "packages": {}
        }
      }
    ],
    "variable": [
      {
        "key": "userId",
        "description": "The user's ID.",
        "value": "12345678"
      }
    ],
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "key": "value",
          "value": "{{api-key}}"
        },
        {
          "key": "key",
          "value": "x-api-key"
        }
      ]
    }
  }
}
```

**Response**

```json
{
  "collection": {
    "id": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "name": "Test Collection",
    "uid": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
  }
}
```

**SDK Code**

```python Replace a Basic Collection's Data
import requests

url = "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2"

payload = { "collection": {
        "info": {
            "name": "Test User Collection",
            "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
            "description": "This is a basic test user collection."
        },
        "item": [
            {
                "id": "5e1bef64-8201-489b-b07c-a1723e008594",
                "name": "Get a user",
                "event": [
                    {
                        "listen": "prerequest",
                        "script": {
                            "id": "fd554123-3124-444c-a4ab-a2ed3c21b794",
                            "type": "text/javascript",
                            "exec": ["try {", "    const response = await pm.sendRequest({", "        url: \"https://postman-echo.com/get\",", "        method: \"GET\"", "    });", "", "    console.log(response.json());", "} catch (err) {", "    console.error(err);", "}"],
                            "packages": {}
                        }
                    },
                    {
                        "listen": "test",
                        "script": {
                            "id": "85a17bb9-3626-4f86-b206-79798e5f8cd7",
                            "type": "text/javascript",
                            "exec": ["pm.test(\"Status code is 200\", function () {", "    pm.response.to.have.status(200);", "});"],
                            "packages": {}
                        }
                    }
                ],
                "request": {
                    "url": {
                        "host": ["api", "getpostman", "com"],
                        "path": ["v1", ":userId"],
                        "protocol": "http",
                        "raw": "http://api.getpostman.com/v1/:userId",
                        "variable": [
                            {
                                "description": "The user ID.",
                                "key": "userId",
                                "value": "{{userId}}"
                            }
                        ]
                    },
                    "method": "GET",
                    "description": "Gets information about a user.",
                    "header": []
                },
                "response": [
                    {
                        "id": "da76da3c-c418-4f72-b47a-24c540badd37",
                        "originalRequest": {
                            "url": {
                                "host": ["api", "getpostman", "com"],
                                "path": ["v1", ":userId"],
                                "protocol": "http",
                                "raw": "http://api.getpostman.com/v1/:userId",
                                "variable": [
                                    {
                                        "description": "The user ID.",
                                        "key": "userId",
                                        "value": "{{userId}}"
                                    }
                                ]
                            },
                            "method": "GET",
                            "header": []
                        },
                        "responseTime": None,
                        "header": [
                            {
                                "description": "",
                                "key": "Content-Type",
                                "type": "text",
                                "value": "application/json"
                            }
                        ],
                        "body": "{
    \"name\": \"Test User\",
    \"userId\": 12345678
}",
                        "status": "OK",
                        "code": 200,
                        "uid": "12345678-da76da3c-c418-4f72-b47a-24c540badd37",
                        "_postman_previewlanguage": "json",
                        "cookie": [],
                        "name": "200 OK"
                    }
                ],
                "protocolProfileBehavior": {
                    "strictSSL": True,
                    "disableBodyPruning": True
                },
                "uid": "12345678-5e1bef64-8201-489b-b07c-a1723e008594"
            },
            {
                "id": "496c0ff9-e602-4506-b7dc-00ecd709d5eb",
                "name": "Delete a user",
                "request": {
                    "url": {
                        "host": ["api", "getpostman", "com"],
                        "path": ["v1", ":userId"],
                        "protocol": "http",
                        "raw": "http://api.getpostman.com/v1/:userId",
                        "variable": [
                            {
                                "description": "The user ID.",
                                "key": "userId",
                                "value": "{{userId}}"
                            }
                        ]
                    },
                    "method": "DELETE",
                    "description": "Deletes a user.",
                    "header": []
                },
                "response": [
                    {
                        "id": "06f9ea8b-55a7-4e8e-ae12-891a050367de",
                        "originalRequest": {
                            "url": {
                                "host": ["api", "getpostman", "com"],
                                "path": ["v1", ":userId"],
                                "protocol": "http",
                                "raw": "http://api.getpostman.com/v1/:userId",
                                "variable": [
                                    {
                                        "description": "The user ID.",
                                        "key": "userId",
                                        "value": "{{userId}}"
                                    }
                                ]
                            },
                            "method": "DELETE",
                            "header": []
                        },
                        "responseTime": None,
                        "body": None,
                        "status": "No Content",
                        "code": 204,
                        "uid": "12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de",
                        "_postman_previewlanguage": None,
                        "cookie": [],
                        "name": "204 No Content"
                    }
                ],
                "protocolProfileBehavior": { "disableBodyPruning": True },
                "uid": "12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb"
            }
        ],
        "event": [
            {
                "listen": "prerequest",
                "script": {
                    "id": "86cc41c1-a9ad-411f-923d-5f1d15344c94",
                    "type": "text/javascript",
                    "exec": [""],
                    "packages": {}
                }
            },
            {
                "listen": "test",
                "script": {
                    "id": "9f48d011-89cb-4a85-9179-b3554aa44aff",
                    "type": "text/javascript",
                    "exec": ["pm.test(\"Content-Type is present\", function () {", "    pm.response.to.have.header(\"Content-Type\");", "});"],
                    "packages": {}
                }
            }
        ],
        "variable": [
            {
                "key": "userId",
                "description": "The user's ID.",
                "value": "12345678"
            }
        ],
        "auth": {
            "type": "apikey",
            "apikey": [
                {
                    "key": "value",
                    "value": "{{api-key}}"
                },
                {
                    "key": "key",
                    "value": "x-api-key"
                }
            ]
        }
    } }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Replace a Basic Collection's Data
const url = 'https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2';
const options = {
  method: 'PUT',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"collection":{"info":{"name":"Test User Collection","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json","description":"This is a basic test user collection."},"item":[{"id":"5e1bef64-8201-489b-b07c-a1723e008594","name":"Get a user","event":[{"listen":"prerequest","script":{"id":"fd554123-3124-444c-a4ab-a2ed3c21b794","type":"text/javascript","exec":["try {","    const response = await pm.sendRequest({","        url: \"https://postman-echo.com/get\",","        method: \"GET\"","    });","","    console.log(response.json());","} catch (err) {","    console.error(err);","}"],"packages":{}}},{"listen":"test","script":{"id":"85a17bb9-3626-4f86-b206-79798e5f8cd7","type":"text/javascript","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});"],"packages":{}}}],"request":{"url":{"host":["api","getpostman","com"],"path":["v1",":userId"],"protocol":"http","raw":"http://api.getpostman.com/v1/:userId","variable":[{"description":"The user ID.","key":"userId","value":"{{userId}}"}]},"method":"GET","description":"Gets information about a user.","header":[]},"response":[{"id":"da76da3c-c418-4f72-b47a-24c540badd37","originalRequest":{"url":{"host":["api","getpostman","com"],"path":["v1",":userId"],"protocol":"http","raw":"http://api.getpostman.com/v1/:userId","variable":[{"description":"The user ID.","key":"userId","value":"{{userId}}"}]},"method":"GET","header":[]},"responseTime":null,"header":[{"description":"","key":"Content-Type","type":"text","value":"application/json"}],"body":"{\n    \"name\": \"Test User\",\n    \"userId\": 12345678\n}","status":"OK","code":200,"uid":"12345678-da76da3c-c418-4f72-b47a-24c540badd37","_postman_previewlanguage":"json","cookie":[],"name":"200 OK"}],"protocolProfileBehavior":{"strictSSL":true,"disableBodyPruning":true},"uid":"12345678-5e1bef64-8201-489b-b07c-a1723e008594"},{"id":"496c0ff9-e602-4506-b7dc-00ecd709d5eb","name":"Delete a user","request":{"url":{"host":["api","getpostman","com"],"path":["v1",":userId"],"protocol":"http","raw":"http://api.getpostman.com/v1/:userId","variable":[{"description":"The user ID.","key":"userId","value":"{{userId}}"}]},"method":"DELETE","description":"Deletes a user.","header":[]},"response":[{"id":"06f9ea8b-55a7-4e8e-ae12-891a050367de","originalRequest":{"url":{"host":["api","getpostman","com"],"path":["v1",":userId"],"protocol":"http","raw":"http://api.getpostman.com/v1/:userId","variable":[{"description":"The user ID.","key":"userId","value":"{{userId}}"}]},"method":"DELETE","header":[]},"responseTime":null,"body":null,"status":"No Content","code":204,"uid":"12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de","_postman_previewlanguage":null,"cookie":[],"name":"204 No Content"}],"protocolProfileBehavior":{"disableBodyPruning":true},"uid":"12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb"}],"event":[{"listen":"prerequest","script":{"id":"86cc41c1-a9ad-411f-923d-5f1d15344c94","type":"text/javascript","exec":[""],"packages":{}}},{"listen":"test","script":{"id":"9f48d011-89cb-4a85-9179-b3554aa44aff","type":"text/javascript","exec":["pm.test(\"Content-Type is present\", function () {","    pm.response.to.have.header(\"Content-Type\");","});"],"packages":{}}}],"variable":[{"key":"userId","description":"The user\'s ID.","value":"12345678"}],"auth":{"type":"apikey","apikey":[{"key":"value","value":"{{api-key}}"},{"key":"key","value":"x-api-key"}]}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Replace a Basic Collection's Data
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2"

	payload := strings.NewReader("{\n  \"collection\": {\n    \"info\": {\n      \"name\": \"Test User Collection\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\",\n      \"description\": \"This is a basic test user collection.\"\n    },\n    \"item\": [\n      {\n        \"id\": \"5e1bef64-8201-489b-b07c-a1723e008594\",\n        \"name\": \"Get a user\",\n        \"event\": [\n          {\n            \"listen\": \"prerequest\",\n            \"script\": {\n              \"id\": \"fd554123-3124-444c-a4ab-a2ed3c21b794\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"try {\",\n                \"    const response = await pm.sendRequest({\",\n                \"        url: \\\"https://postman-echo.com/get\\\",\",\n                \"        method: \\\"GET\\\"\",\n                \"    });\",\n                \"\",\n                \"    console.log(response.json());\",\n                \"} catch (err) {\",\n                \"    console.error(err);\",\n                \"}\"\n              ],\n              \"packages\": {}\n            }\n          },\n          {\n            \"listen\": \"test\",\n            \"script\": {\n              \"id\": \"85a17bb9-3626-4f86-b206-79798e5f8cd7\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"pm.test(\\\"Status code is 200\\\", function () {\",\n                \"    pm.response.to.have.status(200);\",\n                \"});\"\n              ],\n              \"packages\": {}\n            }\n          }\n        ],\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"GET\",\n          \"description\": \"Gets information about a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"GET\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"header\": [\n              {\n                \"description\": \"\",\n                \"key\": \"Content-Type\",\n                \"type\": \"text\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"body\": \"{\\n    \\\"name\\\": \\\"Test User\\\",\\n    \\\"userId\\\": 12345678\\n}\",\n            \"status\": \"OK\",\n            \"code\": 200,\n            \"uid\": \"12345678-da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"_postman_previewlanguage\": \"json\",\n            \"cookie\": [],\n            \"name\": \"200 OK\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"strictSSL\": true,\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-5e1bef64-8201-489b-b07c-a1723e008594\"\n      },\n      {\n        \"id\": \"496c0ff9-e602-4506-b7dc-00ecd709d5eb\",\n        \"name\": \"Delete a user\",\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"DELETE\",\n          \"description\": \"Deletes a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"DELETE\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"body\": null,\n            \"status\": \"No Content\",\n            \"code\": 204,\n            \"uid\": \"12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"_postman_previewlanguage\": null,\n            \"cookie\": [],\n            \"name\": \"204 No Content\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb\"\n      }\n    ],\n    \"event\": [\n      {\n        \"listen\": \"prerequest\",\n        \"script\": {\n          \"id\": \"86cc41c1-a9ad-411f-923d-5f1d15344c94\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"\"\n          ],\n          \"packages\": {}\n        }\n      },\n      {\n        \"listen\": \"test\",\n        \"script\": {\n          \"id\": \"9f48d011-89cb-4a85-9179-b3554aa44aff\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"pm.test(\\\"Content-Type is present\\\", function () {\",\n            \"    pm.response.to.have.header(\\\"Content-Type\\\");\",\n            \"});\"\n          ],\n          \"packages\": {}\n        }\n      }\n    ],\n    \"variable\": [\n      {\n        \"key\": \"userId\",\n        \"description\": \"The user's ID.\",\n        \"value\": \"12345678\"\n      }\n    ],\n    \"auth\": {\n      \"type\": \"apikey\",\n      \"apikey\": [\n        {\n          \"key\": \"value\",\n          \"value\": \"{{api-key}}\"\n        },\n        {\n          \"key\": \"key\",\n          \"value\": \"x-api-key\"\n        }\n      ]\n    }\n  }\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Replace a Basic Collection's Data
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"collection\": {\n    \"info\": {\n      \"name\": \"Test User Collection\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\",\n      \"description\": \"This is a basic test user collection.\"\n    },\n    \"item\": [\n      {\n        \"id\": \"5e1bef64-8201-489b-b07c-a1723e008594\",\n        \"name\": \"Get a user\",\n        \"event\": [\n          {\n            \"listen\": \"prerequest\",\n            \"script\": {\n              \"id\": \"fd554123-3124-444c-a4ab-a2ed3c21b794\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"try {\",\n                \"    const response = await pm.sendRequest({\",\n                \"        url: \\\"https://postman-echo.com/get\\\",\",\n                \"        method: \\\"GET\\\"\",\n                \"    });\",\n                \"\",\n                \"    console.log(response.json());\",\n                \"} catch (err) {\",\n                \"    console.error(err);\",\n                \"}\"\n              ],\n              \"packages\": {}\n            }\n          },\n          {\n            \"listen\": \"test\",\n            \"script\": {\n              \"id\": \"85a17bb9-3626-4f86-b206-79798e5f8cd7\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"pm.test(\\\"Status code is 200\\\", function () {\",\n                \"    pm.response.to.have.status(200);\",\n                \"});\"\n              ],\n              \"packages\": {}\n            }\n          }\n        ],\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"GET\",\n          \"description\": \"Gets information about a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"GET\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"header\": [\n              {\n                \"description\": \"\",\n                \"key\": \"Content-Type\",\n                \"type\": \"text\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"body\": \"{\\n    \\\"name\\\": \\\"Test User\\\",\\n    \\\"userId\\\": 12345678\\n}\",\n            \"status\": \"OK\",\n            \"code\": 200,\n            \"uid\": \"12345678-da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"_postman_previewlanguage\": \"json\",\n            \"cookie\": [],\n            \"name\": \"200 OK\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"strictSSL\": true,\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-5e1bef64-8201-489b-b07c-a1723e008594\"\n      },\n      {\n        \"id\": \"496c0ff9-e602-4506-b7dc-00ecd709d5eb\",\n        \"name\": \"Delete a user\",\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"DELETE\",\n          \"description\": \"Deletes a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"DELETE\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"body\": null,\n            \"status\": \"No Content\",\n            \"code\": 204,\n            \"uid\": \"12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"_postman_previewlanguage\": null,\n            \"cookie\": [],\n            \"name\": \"204 No Content\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb\"\n      }\n    ],\n    \"event\": [\n      {\n        \"listen\": \"prerequest\",\n        \"script\": {\n          \"id\": \"86cc41c1-a9ad-411f-923d-5f1d15344c94\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"\"\n          ],\n          \"packages\": {}\n        }\n      },\n      {\n        \"listen\": \"test\",\n        \"script\": {\n          \"id\": \"9f48d011-89cb-4a85-9179-b3554aa44aff\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"pm.test(\\\"Content-Type is present\\\", function () {\",\n            \"    pm.response.to.have.header(\\\"Content-Type\\\");\",\n            \"});\"\n          ],\n          \"packages\": {}\n        }\n      }\n    ],\n    \"variable\": [\n      {\n        \"key\": \"userId\",\n        \"description\": \"The user's ID.\",\n        \"value\": \"12345678\"\n      }\n    ],\n    \"auth\": {\n      \"type\": \"apikey\",\n      \"apikey\": [\n        {\n          \"key\": \"value\",\n          \"value\": \"{{api-key}}\"\n        },\n        {\n          \"key\": \"key\",\n          \"value\": \"x-api-key\"\n        }\n      ]\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Replace a Basic Collection's Data
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"collection\": {\n    \"info\": {\n      \"name\": \"Test User Collection\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\",\n      \"description\": \"This is a basic test user collection.\"\n    },\n    \"item\": [\n      {\n        \"id\": \"5e1bef64-8201-489b-b07c-a1723e008594\",\n        \"name\": \"Get a user\",\n        \"event\": [\n          {\n            \"listen\": \"prerequest\",\n            \"script\": {\n              \"id\": \"fd554123-3124-444c-a4ab-a2ed3c21b794\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"try {\",\n                \"    const response = await pm.sendRequest({\",\n                \"        url: \\\"https://postman-echo.com/get\\\",\",\n                \"        method: \\\"GET\\\"\",\n                \"    });\",\n                \"\",\n                \"    console.log(response.json());\",\n                \"} catch (err) {\",\n                \"    console.error(err);\",\n                \"}\"\n              ],\n              \"packages\": {}\n            }\n          },\n          {\n            \"listen\": \"test\",\n            \"script\": {\n              \"id\": \"85a17bb9-3626-4f86-b206-79798e5f8cd7\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"pm.test(\\\"Status code is 200\\\", function () {\",\n                \"    pm.response.to.have.status(200);\",\n                \"});\"\n              ],\n              \"packages\": {}\n            }\n          }\n        ],\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"GET\",\n          \"description\": \"Gets information about a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"GET\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"header\": [\n              {\n                \"description\": \"\",\n                \"key\": \"Content-Type\",\n                \"type\": \"text\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"body\": \"{\\n    \\\"name\\\": \\\"Test User\\\",\\n    \\\"userId\\\": 12345678\\n}\",\n            \"status\": \"OK\",\n            \"code\": 200,\n            \"uid\": \"12345678-da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"_postman_previewlanguage\": \"json\",\n            \"cookie\": [],\n            \"name\": \"200 OK\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"strictSSL\": true,\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-5e1bef64-8201-489b-b07c-a1723e008594\"\n      },\n      {\n        \"id\": \"496c0ff9-e602-4506-b7dc-00ecd709d5eb\",\n        \"name\": \"Delete a user\",\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"DELETE\",\n          \"description\": \"Deletes a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"DELETE\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"body\": null,\n            \"status\": \"No Content\",\n            \"code\": 204,\n            \"uid\": \"12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"_postman_previewlanguage\": null,\n            \"cookie\": [],\n            \"name\": \"204 No Content\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb\"\n      }\n    ],\n    \"event\": [\n      {\n        \"listen\": \"prerequest\",\n        \"script\": {\n          \"id\": \"86cc41c1-a9ad-411f-923d-5f1d15344c94\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"\"\n          ],\n          \"packages\": {}\n        }\n      },\n      {\n        \"listen\": \"test\",\n        \"script\": {\n          \"id\": \"9f48d011-89cb-4a85-9179-b3554aa44aff\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"pm.test(\\\"Content-Type is present\\\", function () {\",\n            \"    pm.response.to.have.header(\\\"Content-Type\\\");\",\n            \"});\"\n          ],\n          \"packages\": {}\n        }\n      }\n    ],\n    \"variable\": [\n      {\n        \"key\": \"userId\",\n        \"description\": \"The user's ID.\",\n        \"value\": \"12345678\"\n      }\n    ],\n    \"auth\": {\n      \"type\": \"apikey\",\n      \"apikey\": [\n        {\n          \"key\": \"value\",\n          \"value\": \"{{api-key}}\"\n        },\n        {\n          \"key\": \"key\",\n          \"value\": \"x-api-key\"\n        }\n      ]\n    }\n  }\n}")
  .asString();
```

```php Replace a Basic Collection's Data
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2', [
  'body' => '{
  "collection": {
    "info": {
      "name": "Test User Collection",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
      "description": "This is a basic test user collection."
    },
    "item": [
      {
        "id": "5e1bef64-8201-489b-b07c-a1723e008594",
        "name": "Get a user",
        "event": [
          {
            "listen": "prerequest",
            "script": {
              "id": "fd554123-3124-444c-a4ab-a2ed3c21b794",
              "type": "text/javascript",
              "exec": [
                "try {",
                "    const response = await pm.sendRequest({",
                "        url: \\"https://postman-echo.com/get\\",",
                "        method: \\"GET\\"",
                "    });",
                "",
                "    console.log(response.json());",
                "} catch (err) {",
                "    console.error(err);",
                "}"
              ],
              "packages": {}
            }
          },
          {
            "listen": "test",
            "script": {
              "id": "85a17bb9-3626-4f86-b206-79798e5f8cd7",
              "type": "text/javascript",
              "exec": [
                "pm.test(\\"Status code is 200\\", function () {",
                "    pm.response.to.have.status(200);",
                "});"
              ],
              "packages": {}
            }
          }
        ],
        "request": {
          "url": {
            "host": [
              "api",
              "getpostman",
              "com"
            ],
            "path": [
              "v1",
              ":userId"
            ],
            "protocol": "http",
            "raw": "http://api.getpostman.com/v1/:userId",
            "variable": [
              {
                "description": "The user ID.",
                "key": "userId",
                "value": "{{userId}}"
              }
            ]
          },
          "method": "GET",
          "description": "Gets information about a user.",
          "header": []
        },
        "response": [
          {
            "id": "da76da3c-c418-4f72-b47a-24c540badd37",
            "originalRequest": {
              "url": {
                "host": [
                  "api",
                  "getpostman",
                  "com"
                ],
                "path": [
                  "v1",
                  ":userId"
                ],
                "protocol": "http",
                "raw": "http://api.getpostman.com/v1/:userId",
                "variable": [
                  {
                    "description": "The user ID.",
                    "key": "userId",
                    "value": "{{userId}}"
                  }
                ]
              },
              "method": "GET",
              "header": []
            },
            "responseTime": null,
            "header": [
              {
                "description": "",
                "key": "Content-Type",
                "type": "text",
                "value": "application/json"
              }
            ],
            "body": "{\\n    \\"name\\": \\"Test User\\",\\n    \\"userId\\": 12345678\\n}",
            "status": "OK",
            "code": 200,
            "uid": "12345678-da76da3c-c418-4f72-b47a-24c540badd37",
            "_postman_previewlanguage": "json",
            "cookie": [],
            "name": "200 OK"
          }
        ],
        "protocolProfileBehavior": {
          "strictSSL": true,
          "disableBodyPruning": true
        },
        "uid": "12345678-5e1bef64-8201-489b-b07c-a1723e008594"
      },
      {
        "id": "496c0ff9-e602-4506-b7dc-00ecd709d5eb",
        "name": "Delete a user",
        "request": {
          "url": {
            "host": [
              "api",
              "getpostman",
              "com"
            ],
            "path": [
              "v1",
              ":userId"
            ],
            "protocol": "http",
            "raw": "http://api.getpostman.com/v1/:userId",
            "variable": [
              {
                "description": "The user ID.",
                "key": "userId",
                "value": "{{userId}}"
              }
            ]
          },
          "method": "DELETE",
          "description": "Deletes a user.",
          "header": []
        },
        "response": [
          {
            "id": "06f9ea8b-55a7-4e8e-ae12-891a050367de",
            "originalRequest": {
              "url": {
                "host": [
                  "api",
                  "getpostman",
                  "com"
                ],
                "path": [
                  "v1",
                  ":userId"
                ],
                "protocol": "http",
                "raw": "http://api.getpostman.com/v1/:userId",
                "variable": [
                  {
                    "description": "The user ID.",
                    "key": "userId",
                    "value": "{{userId}}"
                  }
                ]
              },
              "method": "DELETE",
              "header": []
            },
            "responseTime": null,
            "body": null,
            "status": "No Content",
            "code": 204,
            "uid": "12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de",
            "_postman_previewlanguage": null,
            "cookie": [],
            "name": "204 No Content"
          }
        ],
        "protocolProfileBehavior": {
          "disableBodyPruning": true
        },
        "uid": "12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb"
      }
    ],
    "event": [
      {
        "listen": "prerequest",
        "script": {
          "id": "86cc41c1-a9ad-411f-923d-5f1d15344c94",
          "type": "text/javascript",
          "exec": [
            ""
          ],
          "packages": {}
        }
      },
      {
        "listen": "test",
        "script": {
          "id": "9f48d011-89cb-4a85-9179-b3554aa44aff",
          "type": "text/javascript",
          "exec": [
            "pm.test(\\"Content-Type is present\\", function () {",
            "    pm.response.to.have.header(\\"Content-Type\\");",
            "});"
          ],
          "packages": {}
        }
      }
    ],
    "variable": [
      {
        "key": "userId",
        "description": "The user\'s ID.",
        "value": "12345678"
      }
    ],
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "key": "value",
          "value": "{{api-key}}"
        },
        {
          "key": "key",
          "value": "x-api-key"
        }
      ]
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Replace a Basic Collection's Data
using RestSharp;

var client = new RestClient("https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"collection\": {\n    \"info\": {\n      \"name\": \"Test User Collection\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\",\n      \"description\": \"This is a basic test user collection.\"\n    },\n    \"item\": [\n      {\n        \"id\": \"5e1bef64-8201-489b-b07c-a1723e008594\",\n        \"name\": \"Get a user\",\n        \"event\": [\n          {\n            \"listen\": \"prerequest\",\n            \"script\": {\n              \"id\": \"fd554123-3124-444c-a4ab-a2ed3c21b794\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"try {\",\n                \"    const response = await pm.sendRequest({\",\n                \"        url: \\\"https://postman-echo.com/get\\\",\",\n                \"        method: \\\"GET\\\"\",\n                \"    });\",\n                \"\",\n                \"    console.log(response.json());\",\n                \"} catch (err) {\",\n                \"    console.error(err);\",\n                \"}\"\n              ],\n              \"packages\": {}\n            }\n          },\n          {\n            \"listen\": \"test\",\n            \"script\": {\n              \"id\": \"85a17bb9-3626-4f86-b206-79798e5f8cd7\",\n              \"type\": \"text/javascript\",\n              \"exec\": [\n                \"pm.test(\\\"Status code is 200\\\", function () {\",\n                \"    pm.response.to.have.status(200);\",\n                \"});\"\n              ],\n              \"packages\": {}\n            }\n          }\n        ],\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"GET\",\n          \"description\": \"Gets information about a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"GET\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"header\": [\n              {\n                \"description\": \"\",\n                \"key\": \"Content-Type\",\n                \"type\": \"text\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"body\": \"{\\n    \\\"name\\\": \\\"Test User\\\",\\n    \\\"userId\\\": 12345678\\n}\",\n            \"status\": \"OK\",\n            \"code\": 200,\n            \"uid\": \"12345678-da76da3c-c418-4f72-b47a-24c540badd37\",\n            \"_postman_previewlanguage\": \"json\",\n            \"cookie\": [],\n            \"name\": \"200 OK\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"strictSSL\": true,\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-5e1bef64-8201-489b-b07c-a1723e008594\"\n      },\n      {\n        \"id\": \"496c0ff9-e602-4506-b7dc-00ecd709d5eb\",\n        \"name\": \"Delete a user\",\n        \"request\": {\n          \"url\": {\n            \"host\": [\n              \"api\",\n              \"getpostman\",\n              \"com\"\n            ],\n            \"path\": [\n              \"v1\",\n              \":userId\"\n            ],\n            \"protocol\": \"http\",\n            \"raw\": \"http://api.getpostman.com/v1/:userId\",\n            \"variable\": [\n              {\n                \"description\": \"The user ID.\",\n                \"key\": \"userId\",\n                \"value\": \"{{userId}}\"\n              }\n            ]\n          },\n          \"method\": \"DELETE\",\n          \"description\": \"Deletes a user.\",\n          \"header\": []\n        },\n        \"response\": [\n          {\n            \"id\": \"06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"originalRequest\": {\n              \"url\": {\n                \"host\": [\n                  \"api\",\n                  \"getpostman\",\n                  \"com\"\n                ],\n                \"path\": [\n                  \"v1\",\n                  \":userId\"\n                ],\n                \"protocol\": \"http\",\n                \"raw\": \"http://api.getpostman.com/v1/:userId\",\n                \"variable\": [\n                  {\n                    \"description\": \"The user ID.\",\n                    \"key\": \"userId\",\n                    \"value\": \"{{userId}}\"\n                  }\n                ]\n              },\n              \"method\": \"DELETE\",\n              \"header\": []\n            },\n            \"responseTime\": null,\n            \"body\": null,\n            \"status\": \"No Content\",\n            \"code\": 204,\n            \"uid\": \"12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de\",\n            \"_postman_previewlanguage\": null,\n            \"cookie\": [],\n            \"name\": \"204 No Content\"\n          }\n        ],\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"uid\": \"12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb\"\n      }\n    ],\n    \"event\": [\n      {\n        \"listen\": \"prerequest\",\n        \"script\": {\n          \"id\": \"86cc41c1-a9ad-411f-923d-5f1d15344c94\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"\"\n          ],\n          \"packages\": {}\n        }\n      },\n      {\n        \"listen\": \"test\",\n        \"script\": {\n          \"id\": \"9f48d011-89cb-4a85-9179-b3554aa44aff\",\n          \"type\": \"text/javascript\",\n          \"exec\": [\n            \"pm.test(\\\"Content-Type is present\\\", function () {\",\n            \"    pm.response.to.have.header(\\\"Content-Type\\\");\",\n            \"});\"\n          ],\n          \"packages\": {}\n        }\n      }\n    ],\n    \"variable\": [\n      {\n        \"key\": \"userId\",\n        \"description\": \"The user's ID.\",\n        \"value\": \"12345678\"\n      }\n    ],\n    \"auth\": {\n      \"type\": \"apikey\",\n      \"apikey\": [\n        {\n          \"key\": \"value\",\n          \"value\": \"{{api-key}}\"\n        },\n        {\n          \"key\": \"key\",\n          \"value\": \"x-api-key\"\n        }\n      ]\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Replace a Basic Collection's Data
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["collection": [
    "info": [
      "name": "Test User Collection",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
      "description": "This is a basic test user collection."
    ],
    "item": [
      [
        "id": "5e1bef64-8201-489b-b07c-a1723e008594",
        "name": "Get a user",
        "event": [
          [
            "listen": "prerequest",
            "script": [
              "id": "fd554123-3124-444c-a4ab-a2ed3c21b794",
              "type": "text/javascript",
              "exec": ["try {", "    const response = await pm.sendRequest({", "        url: \"https://postman-echo.com/get\",", "        method: \"GET\"", "    });", "", "    console.log(response.json());", "} catch (err) {", "    console.error(err);", "}"],
              "packages": []
            ]
          ],
          [
            "listen": "test",
            "script": [
              "id": "85a17bb9-3626-4f86-b206-79798e5f8cd7",
              "type": "text/javascript",
              "exec": ["pm.test(\"Status code is 200\", function () {", "    pm.response.to.have.status(200);", "});"],
              "packages": []
            ]
          ]
        ],
        "request": [
          "url": [
            "host": ["api", "getpostman", "com"],
            "path": ["v1", ":userId"],
            "protocol": "http",
            "raw": "http://api.getpostman.com/v1/:userId",
            "variable": [
              [
                "description": "The user ID.",
                "key": "userId",
                "value": "{{userId}}"
              ]
            ]
          ],
          "method": "GET",
          "description": "Gets information about a user.",
          "header": []
        ],
        "response": [
          [
            "id": "da76da3c-c418-4f72-b47a-24c540badd37",
            "originalRequest": [
              "url": [
                "host": ["api", "getpostman", "com"],
                "path": ["v1", ":userId"],
                "protocol": "http",
                "raw": "http://api.getpostman.com/v1/:userId",
                "variable": [
                  [
                    "description": "The user ID.",
                    "key": "userId",
                    "value": "{{userId}}"
                  ]
                ]
              ],
              "method": "GET",
              "header": []
            ],
            "responseTime": ,
            "header": [
              [
                "description": "",
                "key": "Content-Type",
                "type": "text",
                "value": "application/json"
              ]
            ],
            "body": "{
    \"name\": \"Test User\",
    \"userId\": 12345678
}",
            "status": "OK",
            "code": 200,
            "uid": "12345678-da76da3c-c418-4f72-b47a-24c540badd37",
            "_postman_previewlanguage": "json",
            "cookie": [],
            "name": "200 OK"
          ]
        ],
        "protocolProfileBehavior": [
          "strictSSL": true,
          "disableBodyPruning": true
        ],
        "uid": "12345678-5e1bef64-8201-489b-b07c-a1723e008594"
      ],
      [
        "id": "496c0ff9-e602-4506-b7dc-00ecd709d5eb",
        "name": "Delete a user",
        "request": [
          "url": [
            "host": ["api", "getpostman", "com"],
            "path": ["v1", ":userId"],
            "protocol": "http",
            "raw": "http://api.getpostman.com/v1/:userId",
            "variable": [
              [
                "description": "The user ID.",
                "key": "userId",
                "value": "{{userId}}"
              ]
            ]
          ],
          "method": "DELETE",
          "description": "Deletes a user.",
          "header": []
        ],
        "response": [
          [
            "id": "06f9ea8b-55a7-4e8e-ae12-891a050367de",
            "originalRequest": [
              "url": [
                "host": ["api", "getpostman", "com"],
                "path": ["v1", ":userId"],
                "protocol": "http",
                "raw": "http://api.getpostman.com/v1/:userId",
                "variable": [
                  [
                    "description": "The user ID.",
                    "key": "userId",
                    "value": "{{userId}}"
                  ]
                ]
              ],
              "method": "DELETE",
              "header": []
            ],
            "responseTime": ,
            "body": ,
            "status": "No Content",
            "code": 204,
            "uid": "12345678-06f9ea8b-55a7-4e8e-ae12-891a050367de",
            "_postman_previewlanguage": ,
            "cookie": [],
            "name": "204 No Content"
          ]
        ],
        "protocolProfileBehavior": ["disableBodyPruning": true],
        "uid": "12345678-496c0ff9-e602-4506-b7dc-00ecd709d5eb"
      ]
    ],
    "event": [
      [
        "listen": "prerequest",
        "script": [
          "id": "86cc41c1-a9ad-411f-923d-5f1d15344c94",
          "type": "text/javascript",
          "exec": [""],
          "packages": []
        ]
      ],
      [
        "listen": "test",
        "script": [
          "id": "9f48d011-89cb-4a85-9179-b3554aa44aff",
          "type": "text/javascript",
          "exec": ["pm.test(\"Content-Type is present\", function () {", "    pm.response.to.have.header(\"Content-Type\");", "});"],
          "packages": []
        ]
      ]
    ],
    "variable": [
      [
        "key": "userId",
        "description": "The user's ID.",
        "value": "12345678"
      ]
    ],
    "auth": [
      "type": "apikey",
      "apikey": [
        [
          "key": "value",
          "value": "{{api-key}}"
        ],
        [
          "key": "key",
          "value": "x-api-key"
        ]
      ]
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```