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

# Update the value of a credential field

> Updates the value of an existing field on a credential, identified by `packageName`, `credentialName`, and `fieldType` in the path. The body carries the new value and returns the updated credential.



## OpenAPI

````yaml /api-reference/credentials-ref/credential-packages.yaml patch /credentials/packages/{packageName}/credentials/{credentialName}/fields/{fieldType}
openapi: 3.1.0
info:
  title: Credential Packages
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /credentials/packages/{packageName}/credentials/{credentialName}/fields/{fieldType}:
    patch:
      tags:
        - Credential Packages
      summary: Update the value of a credential field
      description: >-
        Updates the value of an existing field on a credential, identified by
        `packageName`, `credentialName`, and `fieldType` in the path. The body
        carries the new value and returns the updated credential.
      operationId: updateCredentialFieldValue
      parameters:
        - in: path
          name: packageName
          required: true
          schema:
            maxLength: 200
            minLength: 1
            type: string
        - in: path
          name: credentialName
          required: true
          schema:
            maxLength: 50
            minLength: 3
            pattern: ^[a-z0-9_-]+$
            type: string
        - in: path
          name: fieldType
          required: true
          schema:
            enum:
              - email
              - username
              - password
              - api_token
              - phone_number
              - two_factor_secret
              - backup_codes
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCredentialFieldBody'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/Credential'
                  message:
                    type: string
                  success:
                    enum:
                      - true
                    type: boolean
                required:
                  - success
                  - message
                  - data
                type: object
          description: Field value updated
        '400':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/CredentialErrorResponse'
                  - $ref: '#/components/schemas/ApiErrorEnvelope'
          description: >-
            Bad Request — invalid_request, package_exists, create_failed,
            update_failed, protocol_change_not_allowed (legacy body + additive
            code/message), or a generic request validation failure
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialErrorResponse'
          description: >-
            Not Found — credential_not_found, proxy_not_found (legacy body +
            additive code/message)
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialErrorResponse'
          description: Conflict (legacy body + additive code/message)
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialErrorResponse'
          description: Credential source rate limited
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
          description: Internal Server Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Mobilerun from '@mobilerun/sdk';


            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });


            const field = await
            client.credentials.packages.credentials.fields.update('email', {
              packageName: 'x',
              credentialName: '26f1kl_-n-71',
              value: 'x',
            });


            console.log(field.data);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            field = client.credentials.packages.credentials.fields.update(
                field_type="email",
                package_name="x",
                credential_name="26f1kl_-n-71",
                value="x",
            )
            print(field.data)
components:
  schemas:
    UpdateCredentialFieldBody:
      properties:
        value:
          minLength: 1
          type: string
      required:
        - value
      type: object
    Credential:
      properties:
        createdBy:
          type:
            - string
            - 'null'
        credentialName:
          type: string
        fields:
          items:
            properties:
              fieldType:
                enum:
                  - email
                  - username
                  - password
                  - api_token
                  - phone_number
                  - two_factor_secret
                  - backup_codes
                type: string
              value:
                minLength: 1
                type: string
            required:
              - fieldType
              - value
            type: object
          type: array
        link:
          properties:
            fieldMap:
              items:
                properties:
                  fieldId:
                    minLength: 1
                    type: string
                  fieldType:
                    enum:
                      - email
                      - username
                      - password
                      - api_token
                      - phone_number
                      - two_factor_secret
                      - backup_codes
                    type: string
                required:
                  - fieldType
                  - fieldId
                type: object
              minItems: 1
              type: array
            itemId:
              minLength: 1
              type: string
            itemTitle:
              type: string
            provider:
              enum:
                - onepassword
              type: string
            vaultId:
              minLength: 1
              type: string
            vaultName:
              type: string
          required:
            - provider
            - vaultId
            - vaultName
            - itemId
            - itemTitle
            - fieldMap
          type: object
        ownerId:
          type: string
        packageName:
          type: string
        secretPath:
          type: string
        source:
          enum:
            - mobilerun
            - onepassword
          type: string
        userId:
          deprecated: true
          description: >-
            Deprecated: use createdBy (same value — the creating actor). Null
            for credentials created before rollout.
          type:
            - string
            - 'null'
      required:
        - ownerId
        - createdBy
        - userId
        - packageName
        - secretPath
        - credentialName
        - fields
      type: object
    CredentialErrorResponse:
      properties:
        code:
          $ref: '#/components/schemas/CredentialErrorCode'
        message:
          type: string
      required:
        - code
        - message
      type: object
    ApiErrorEnvelope:
      properties:
        code:
          type: string
        details: {}
        message:
          type: string
        retryAfterSeconds:
          type: number
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    InternalServerError:
      properties:
        code:
          type: string
        message:
          type: string
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    CredentialErrorCode:
      enum:
        - credential_read_only
        - credential_source_unavailable
        - credential_source_rate_limited
        - onepassword_not_connected
        - onepassword_token_invalid
        - onepassword_no_vaults
        - onepassword_reference_invalid
        - invalid_request
        - package_exists
        - credential_not_found
        - proxy_not_found
        - create_failed
        - update_failed
        - protocol_change_not_allowed
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

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