> ## Documentation Index
> Fetch the complete documentation index at: https://developers.datagrid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update data-sharing consent

> Sets the authenticated user's data-sharing consent. Only a user session may change consent; an API key is refused. The response returns the resulting effective consent, which can still be `false` when an administrator has disabled data sharing.




## OpenAPI

````yaml put /identity/data-sharing-opt-in
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /identity/data-sharing-opt-in:
    put:
      tags:
        - Identity
      summary: Update data-sharing consent
      description: >
        Sets the authenticated user's data-sharing consent. Only a user session
        may change consent; an API key is refused. The response returns the
        resulting effective consent, which can still be `false` when an
        administrator has disabled data sharing.
      operationId: UpdateDataSharingOptIn
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDataSharingOptInRequest'
      responses:
        '200':
          description: Updated data-sharing consent for the caller
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataSharingOptIn'
        '403':
          description: >-
            Forbidden. The request used an API key. Consent can only be changed
            from a user session.
        '429':
          description: >-
            Rate limit exceeded. The request has been throttled because the rate
            limit for this endpoint has been reached. Check the `Retry-After`
            response header and retry after the specified number of seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
components:
  schemas:
    UpdateDataSharingOptInRequest:
      type: object
      required:
        - consent
      properties:
        consent:
          type: boolean
          description: Whether the user agrees to data sharing.
    DataSharingOptIn:
      type: object
      required:
        - object
        - consent
        - effective_consent
        - reason
      properties:
        object:
          type: string
          enum:
            - data_sharing_opt_in
        consent:
          type: boolean
          nullable: true
          description: The user's own data-sharing choice. `null` until the user answers.
        effective_consent:
          type: boolean
          nullable: true
          description: >-
            Whether the user's feedback is shared after administrator settings
            apply. `false` when an account or teamspace administrator disabled
            data sharing, whatever `consent` is.
        reason:
          type: string
          enum:
            - disabled_by_administrator
            - user_preference
          description: The setting that determined `effective_consent`.
    RateLimitError:
      type: object
      description: >-
        Returned when the rate limit is exceeded. Rate limits are enforced per
        teamspace, endpoint path, and HTTP method over a 60-second sliding
        window. Each endpoint may have its own limit — check the
        X-RateLimit-Limit response header for the effective value.
      required:
        - error
        - message
        - retryable
        - status_code
      properties:
        status_code:
          type: integer
          description: The HTTP status code (429).
        statusCode:
          type: integer
          deprecated: true
          description: Deprecated. Use status_code instead.
        error:
          type: string
          enum:
            - rate_limit_exceeded
          description: The error code identifying this as a rate limit error.
        message:
          type: string
          description: A human-readable error message.
        mitigation:
          type: string
          description: Suggested action to resolve the error.
        retryable:
          type: boolean
          description: Whether the request can be retried after a delay.
        details:
          type: object
          properties:
            reason:
              type: string
              description: A detailed explanation of why the rate limit was exceeded.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.