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

# Update a contract

> Update a contract



## OpenAPI

````yaml /api-reference/openapi.documented.json post /api/contracts/{id}
openapi: 3.0.2
info:
  title: Snag Solutions - API Docs
  description: >-
    Documentation for Loyalty & Socials APIs. Some endpoints require an API key
    to authenticate. To obtain a key, reach out to the Snag Solutions team at
    support@snagsolutions.io.
  version: '0.1'
servers:
  - url: https://admin.snagsolutions.io/
    description: Production
security: []
paths:
  /api/contracts/{id}:
    post:
      tags:
        - Contract
      summary: Update a contract
      description: Update a contract
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Body
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 40
                abi:
                  nullable: true
                type:
                  type: string
                  enum:
                    - erc20
                    - erc721
                    - erc1155
                    - custom
                iconUrl:
                  type: string
                  format: uri
                  nullable: true
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    title: ID
                    description: Unique identifier for the contract
                    example: 123e4567-e89b-12d3-a456-426614174003
                  name:
                    type: string
                    maxLength: 40
                    nullable: true
                    title: Name
                    description: Name of the contract
                    example: My Contract
                  address:
                    type: string
                    pattern: ^0x[a-fA-F0-9]{40}$
                    title: Address
                    description: Contract address matching the required format
                    example: 0xabc123...
                  chainId:
                    type: integer
                    format: int64
                    title: Chain ID
                    description: ID of the blockchain chain
                    example: 1
                  abi:
                    nullable: true
                    title: ABI
                    description: Application Binary Interface of the contract
                    example: '[{ "constant": true, ... }]'
                  type:
                    type: string
                    enum:
                      - erc20
                      - erc721
                      - erc1155
                      - custom
                    title: Type
                    description: Type of the contract
                    example: ERC721
                  organizationId:
                    type: string
                    format: uuid
                    title: Organization ID
                    description: Unique identifier for the organization
                    example: 123e4567-e89b-12d3-a456-426614174002
                  iconUrl:
                    type: string
                    format: uri
                    nullable: true
                    title: Icon URL
                    description: >-
                      Optional icon image for the contract; used as the reward
                      token icon
                    example: https://cdn.example.com/contract-icon.png
                required:
                  - id
                  - name
                  - address
                  - chainId
                  - type
                  - organizationId
                title: Contract Schema
                description: Schema for a contract
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    title: Message
                    description: Error message
                    example: Request body is invalid
                required:
                  - message
                title: Bad Request Response
                description: Schema for bad request response
        '404':
          description: '404'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    title: Message
                    description: Error message
                    example: Not found
                required:
                  - message
                title: Not Found Response
                description: Schema for not found response
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````