> ## Documentation Index
> Fetch the complete documentation index at: https://vectorly-783efd43.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create new object.

> Create new object.

### Example
Create model:
```
POST /api/object
{
    "payload": {
        "object_type": "model",
        "name": "model name",
        "type": "local",
        "content": {
            "meta": {"entrance_file": "main.jl"},
            "tree": [],
        }
    }
}
```

Create model from GitHub repo:
```
POST /api/object
{
    "payload": {
        "object_type": "model",
        "repo": "vectorly-ai/simple-model",
        "branch": "main",
        "type": "repo",
    }
}
```

Create model from GitHub gist:
```
POST /api/object
{
    "payload": {
        "object_type": "model",
        "repo": "<the-gist-id>",
        "type": "gist",
    }
}
```

Create experiment:
```
POST /api/object
{
    "payload": {
        "object_type": "experiment",
        "name": "experiment name",
        "model_id": "M1234567",
    }
}
```



## OpenAPI

````yaml post /api/object
openapi: 3.1.0
info:
  title: Coinfer Server API
  version: 0.0.1776236533+0db4b8c
  description: |+

    This part of document describes the HTTP APIs of the Coinfer cloud.

servers:
  - url: https://api.coinfer.ai
    description: The production environment
  - url: https://dev.coinfer.ai
    description: The development environment
security: []
tags:
  - name: Object
    description: APIs related to object CRUD operations.
  - name: Invoke
    description: APIs used to invoke CloudFunction or run workflow.
  - name: Notification
    description: APIs related to notification.
  - name: Authorization
    description: >-
      APIs related to user, token, login, etc.


      Normally APIs in this group should not be used. You should get API token
      from our website and then use the token to call other APIs.
paths:
  /api/object:
    post:
      tags:
        - Object
      summary: Create new object.
      description: |-
        Create new object.

        ### Example
        Create model:
        ```
        POST /api/object
        {
            "payload": {
                "object_type": "model",
                "name": "model name",
                "type": "local",
                "content": {
                    "meta": {"entrance_file": "main.jl"},
                    "tree": [],
                }
            }
        }
        ```

        Create model from GitHub repo:
        ```
        POST /api/object
        {
            "payload": {
                "object_type": "model",
                "repo": "vectorly-ai/simple-model",
                "branch": "main",
                "type": "repo",
            }
        }
        ```

        Create model from GitHub gist:
        ```
        POST /api/object
        {
            "payload": {
                "object_type": "model",
                "repo": "<the-gist-id>",
                "type": "gist",
            }
        }
        ```

        Create experiment:
        ```
        POST /api/object
        {
            "payload": {
                "object_type": "experiment",
                "name": "experiment name",
                "model_id": "M1234567",
            }
        }
        ```
      operationId: coinfer_apis_unified_api_create_object
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateObjectReq'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/SuccRsp_Annotated_Union_ExperimentRsp__ListModelsRspItem__CreateShareRsp__CreateEventRsp__CreateCallbackRsp__CreateRelationRsp__CreateDataRsp__CreateWorkflowRsp___FieldInfo_annotation_NoneType__required_True__discriminator__object_type____
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrRsp'
      security:
        - GlobalAuth: []
components:
  schemas:
    CreateObjectReq:
      properties:
        payload:
          discriminator:
            mapping:
              callback:
                $ref: '#/components/schemas/CreateCallbackReq'
              data:
                $ref: '#/components/schemas/CreateDataReq'
              event:
                $ref: '#/components/schemas/CreateEventReq'
              experiment:
                $ref: '#/components/schemas/CreateExperiment'
              model:
                $ref: '#/components/schemas/CreateModel'
              relation:
                $ref: '#/components/schemas/CreateRelationReq'
              share:
                $ref: '#/components/schemas/CreateExperimentShare'
              workflow:
                $ref: '#/components/schemas/CreateWorkflowReq'
            propertyName: object_type
          oneOf:
            - $ref: '#/components/schemas/CreateModel'
            - $ref: '#/components/schemas/CreateExperiment'
            - $ref: '#/components/schemas/CreateExperimentShare'
            - $ref: '#/components/schemas/CreateEventReq'
            - $ref: '#/components/schemas/CreateCallbackReq'
            - $ref: '#/components/schemas/CreateRelationReq'
            - $ref: '#/components/schemas/CreateDataReq'
            - $ref: '#/components/schemas/CreateWorkflowReq'
          title: Payload
      required:
        - payload
      title: CreateObjectReq
      type: object
    SuccRsp_Annotated_Union_ExperimentRsp__ListModelsRspItem__CreateShareRsp__CreateEventRsp__CreateCallbackRsp__CreateRelationRsp__CreateDataRsp__CreateWorkflowRsp___FieldInfo_annotation_NoneType__required_True__discriminator__object_type____:
      properties:
        status:
          const: ok
          title: Status
          type: string
        data:
          discriminator:
            mapping:
              callback:
                $ref: '#/components/schemas/CreateCallbackRsp'
              data:
                $ref: '#/components/schemas/CreateDataRsp'
              event:
                $ref: '#/components/schemas/CreateEventRsp'
              experiment:
                $ref: '#/components/schemas/ExperimentRsp'
              model:
                $ref: '#/components/schemas/ListModelsRspItem'
              relation:
                $ref: '#/components/schemas/CreateRelationRsp'
              share:
                $ref: '#/components/schemas/CreateShareRsp'
              workflow:
                $ref: '#/components/schemas/CreateWorkflowRsp'
            propertyName: object_type
          oneOf:
            - $ref: '#/components/schemas/ExperimentRsp'
            - $ref: '#/components/schemas/ListModelsRspItem'
            - $ref: '#/components/schemas/CreateShareRsp'
            - $ref: '#/components/schemas/CreateEventRsp'
            - $ref: '#/components/schemas/CreateCallbackRsp'
            - $ref: '#/components/schemas/CreateRelationRsp'
            - $ref: '#/components/schemas/CreateDataRsp'
            - $ref: '#/components/schemas/CreateWorkflowRsp'
          title: Data
      required:
        - status
        - data
      title: >-
        SuccRsp[Annotated[Union[ExperimentRsp, ListModelsRspItem,
        CreateShareRsp, CreateEventRsp, CreateCallbackRsp, CreateRelationRsp,
        CreateDataRsp, CreateWorkflowRsp], FieldInfo(annotation=NoneType,
        required=True, discriminator='object_type')]]
      type: object
    ErrRsp:
      properties:
        status:
          const: error
          title: Status
          type: string
        code:
          title: Code
          type: string
        message:
          title: Message
          type: string
      required:
        - status
        - code
        - message
      title: ErrRsp
      type: object
    CreateCallbackReq:
      properties:
        object_type:
          const: callback
          title: Object Type
          type: string
        lang:
          enum:
            - julia
            - python
          title: Lang
          type: string
        code:
          description: |-
            code location specification. Can be:
            1. GitHub gist: gist:<gist-id>:<entrance-file>
            2. GitHub repo: repo:<repo-owner>/<repo-name>:<entrance-file>
          title: Code
          type: string
        single_instance:
          default: true
          description: Only allow one instance of this callback to run at a time.
          title: Single Instance
          type: boolean
      required:
        - object_type
        - lang
        - code
      title: CreateCallbackReq
      type: object
    CreateDataReq:
      properties:
        object_type:
          const: data
          title: Object Type
          type: string
        name:
          description: Data name
          maxLength: 255
          minLength: 1
          title: Name
          type: string
        description:
          default: ''
          description: Data description
          maxLength: 2048
          title: Description
          type: string
        base64_encoded:
          default: false
          description: Whether the data in `data` is base64 encoded
          title: Base64 Encoded
          type: boolean
        data:
          default: ''
          description: File data in text format
          title: Data
          type: string
        data_uri:
          default: ''
          description: File data URI
          title: Data Uri
          type: string
        tags:
          description: Data tags
          items:
            $ref: '#/components/schemas/DataTag'
          title: Tags
          type: array
      required:
        - object_type
        - name
      title: CreateDataReq
      type: object
    CreateEventReq:
      properties:
        object_type:
          const: event
          title: Object Type
          type: string
        name:
          title: Name
          type: string
      required:
        - object_type
        - name
      title: CreateEventReq
      type: object
    CreateExperiment:
      properties:
        object_type:
          const: experiment
          title: Object Type
          type: string
        model_id:
          default: ''
          title: Model Id
          type: string
        workflow_id:
          default: ''
          title: Workflow Id
          type: string
        input_id:
          default: ''
          title: Input Id
          type: string
        meta:
          title: Meta
        name:
          default: ''
          title: Name
          type: string
        run_on:
          default: lambda
          enum:
            - lambda
            - fargate
            - local
          title: Run On
          type: string
        data_file_type:
          anyOf:
            - enum:
                - turing csv
                - stan csv
                - arviz netcdf
              type: string
            - type: 'null'
          title: Data File Type
        data_files:
          description: File data in text format
          items:
            type: string
          title: Data Files
          type: array
        data_uris:
          description: File data URI
          items:
            type: string
          title: Data Uris
          type: array
      required:
        - object_type
      title: CreateExperiment
      type: object
    CreateModel:
      properties:
        object_type:
          const: model
          title: Object Type
          type: string
        type:
          default: local
          description: >-
            The type of input code. It can be:


            * local: the code is provided directly in `content` field as Unified
            Model Format.

            * url: the code is provided by a URL and specified by param
            `source_url`.
          enum:
            - local
            - url
          title: Type
          type: string
        env:
          anyOf:
            - type: string
            - type: 'null'
          title: Env
        name:
          default: ''
          description: model name
          title: Name
          type: string
        content:
          anyOf:
            - $ref: '#/components/schemas/ModelContent'
            - type: 'null'
        tags:
          description: Model tags
          items:
            $ref: '#/components/schemas/CloudFunctionKind'
          title: Tags
          type: array
        single_instance:
          default: true
          description: Only allow one instance to run as cloud function at a time.
          title: Single Instance
          type: boolean
        lang:
          anyOf:
            - $ref: '#/components/schemas/CloudFunctionLang'
            - type: 'null'
          description: Programming language of the model
        entrance_file:
          default: ''
          title: Entrance File
          type: string
        lambda_image:
          default: false
          description: Whether to build lambda image for this CloudFunction
          title: Lambda Image
          type: boolean
        source_url:
          default: ''
          description: Source URL from where to import the model
          title: Source Url
          type: string
      required:
        - object_type
      title: CreateModel
      type: object
    CreateRelationReq:
      properties:
        object_type:
          const: relation
          title: Object Type
          type: string
        object1_id:
          title: Object1 Id
          type: string
        object2_id:
          title: Object2 Id
          type: string
      required:
        - object_type
        - object1_id
        - object2_id
      title: CreateRelationReq
      type: object
    CreateExperimentShare:
      properties:
        object_type:
          const: share
          title: Object Type
          type: string
        objid:
          title: Objid
          type: string
      required:
        - object_type
        - objid
      title: CreateExperimentShare
      type: object
    CreateWorkflowReq:
      properties:
        object_type:
          const: workflow
          title: Object Type
          type: string
        name:
          default: ''
          description: workflow name
          maxLength: 255
          title: Name
          type: string
        model_id:
          default: ''
          description: model ID
          maxLength: 9
          title: Model Id
          type: string
        data_id:
          default: ''
          description: data ID
          maxLength: 9
          title: Data Id
          type: string
        uri:
          default: ''
          description: URI of model in Gallery
          title: Uri
          type: string
        zip_data:
          default: ''
          description: workflow zip archive encoded in base64
          title: Zip Data
          type: string
      required:
        - object_type
      title: CreateWorkflowReq
      type: object
    CreateCallbackRsp:
      properties:
        object_type:
          const: callback
          title: Object Type
          type: string
        short_id:
          title: Short Id
          type: string
        lang:
          title: Lang
          type: string
        code:
          title: Code
          type: string
        token:
          title: Token
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
      required:
        - object_type
        - short_id
        - lang
        - code
        - token
        - created_at
      title: CreateCallbackRsp
      type: object
    CreateDataRsp:
      properties:
        object_type:
          const: data
          title: Object Type
          type: string
        name:
          title: Name
          type: string
        description:
          title: Description
          type: string
        short_id:
          title: Short Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        updated_at:
          format: date-time
          title: Updated At
          type: string
        path:
          default: ''
          title: Path
          type: string
        fmt:
          default: raw
          title: Fmt
          type: string
        tags:
          description: Data tags
          items:
            $ref: '#/components/schemas/DataTag'
          title: Tags
          type: array
      required:
        - object_type
        - name
        - description
        - short_id
        - created_at
        - updated_at
      title: CreateDataRsp
      type: object
    CreateEventRsp:
      properties:
        object_type:
          const: event
          title: Object Type
          type: string
        name:
          title: Name
          type: string
        short_id:
          title: Short Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
      required:
        - object_type
        - name
        - short_id
        - created_at
      title: CreateEventRsp
      type: object
    ExperimentRsp:
      properties:
        object_type:
          const: experiment
          title: Object Type
          type: string
        short_id:
          default: ''
          title: Short Id
          type: string
        name:
          default: ''
          title: Name
          type: string
        model_id:
          default: ''
          title: Model Id
          type: string
        status:
          default: ''
          title: Status
          type: string
        meta:
          title: Meta
        n_chains:
          default: 0
          title: N Chains
          type: integer
        n_variables:
          default: 0
          title: N Variables
          type: integer
        n_samples:
          default: 0
          title: N Samples
          type: integer
        sample_update_time:
          default: ''
          format: date-time
          title: Sample Update Time
          type: string
        run_on:
          default: ''
          title: Run On
          type: string
        input:
          anyOf:
            - type: string
            - type: 'null'
          title: Input
        output:
          anyOf:
            - type: string
            - type: 'null'
          title: Output
        model_name:
          title: Model Name
          type: string
        workflow_id:
          default: ''
          title: Workflow Id
          type: string
        workflow_name:
          default: ''
          title: Workflow Name
          type: string
      required:
        - object_type
        - model_name
      title: ExperimentRsp
      type: object
    ListModelsRspItem:
      properties:
        object_type:
          const: model
          title: Object Type
          type: string
        id:
          title: Id
          type: integer
        short_id:
          title: Short Id
          type: string
        name:
          title: Name
          type: string
        content:
          title: Content
        meta:
          $ref: '#/components/schemas/_ModelMetaInRsp'
        tags:
          items:
            type: string
          title: Tags
          type: array
        lambda_image_url:
          anyOf:
            - type: string
            - type: 'null'
          default: ''
          title: Lambda Image Url
        lambda_image_name:
          anyOf:
            - type: string
            - type: 'null'
          default: ''
          title: Lambda Image Name
      required:
        - object_type
        - id
        - short_id
        - name
        - meta
        - tags
      title: ListModelsRspItem
      type: object
    CreateRelationRsp:
      properties:
        object_type:
          const: relation
          title: Object Type
          type: string
        short_id:
          title: Short Id
          type: string
        user_id:
          title: User Id
          type: integer
        object1_id:
          title: Object1 Id
          type: string
        object2_id:
          title: Object2 Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
      required:
        - object_type
        - short_id
        - user_id
        - object1_id
        - object2_id
        - created_at
      title: CreateRelationRsp
      type: object
    CreateShareRsp:
      properties:
        object_type:
          const: share
          title: Object Type
          type: string
        id:
          title: Id
          type: integer
        user_id:
          title: User Id
          type: integer
        short_id:
          title: Short Id
          type: string
        experiment_id:
          default: ''
          title: Experiment Id
          type: string
        experiment_name:
          default: ''
          title: Experiment Name
          type: string
        target_id:
          default: ''
          title: Target Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        from_user:
          anyOf:
            - type: string
            - type: 'null'
          title: From User
      required:
        - object_type
        - id
        - user_id
        - short_id
        - created_at
      title: CreateShareRsp
      type: object
    CreateWorkflowRsp:
      properties:
        object_type:
          const: workflow
          title: Object Type
          type: string
        short_id:
          title: Short Id
          type: string
        name:
          title: Name
          type: string
        model_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Id
        model_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Name
        data_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Data Id
        data_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Data Name
        data_fmt:
          anyOf:
            - type: string
            - type: 'null'
          title: Data Fmt
        experiment_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Experiment Id
        experiment_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Experiment Name
        analyzer_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Analyzer Id
        analyzer_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Analyzer Name
        created_at:
          format: date-time
          title: Created At
          type: string
        updated_at:
          format: date-time
          title: Updated At
          type: string
        startup_script:
          anyOf:
            - type: string
            - type: 'null'
          title: Startup Script
        settings:
          anyOf:
            - type: string
            - type: 'null'
          title: Settings
        data_script:
          anyOf:
            - type: string
            - type: 'null'
          title: Data Script
        share_info:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Share Info
      required:
        - object_type
        - short_id
        - name
        - created_at
        - updated_at
      title: CreateWorkflowRsp
      type: object
    DataTag:
      enum:
        - anonymous
      title: DataTag
      type: string
    ModelContent:
      properties:
        meta:
          allOf:
            - $ref: '#/components/schemas/ModelMeta'
          default:
            project_file: Project.toml
            entrance_file: main.jl
            entrance_func: model
            manifest: Manifest.toml
        tree:
          items:
            $ref: '#/components/schemas/ModelTreeNode'
          title: Tree
          type: array
      title: ModelContent
      type: object
    CloudFunctionKind:
      description: |-
        Categories (types) of cloud functions, e.g., MODEL or CODE.
        These categories are also used as tags elsewhere in the system.
      enum:
        - model
        - code
        - anonymous
      title: CloudFunctionKind
      type: string
    CloudFunctionLang:
      enum:
        - python
        - julia
      title: CloudFunctionLang
      type: string
    _ModelMetaInRsp:
      properties:
        github:
          anyOf:
            - type: string
            - type: 'null'
          title: Github
        commit_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Commit Id
        origin_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Origin Url
        fixed_version_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Fixed Version Url
      title: _ModelMetaInRsp
      type: object
    ModelMeta:
      properties:
        project_file:
          default: Project.toml
          title: Project File
          type: string
        entrance_file:
          default: main.jl
          title: Entrance File
          type: string
        entrance_func:
          default: model
          title: Entrance Func
          type: string
        manifest:
          default: Manifest.toml
          title: Manifest
          type: string
      title: ModelMeta
      type: object
    ModelTreeNode:
      properties:
        name:
          title: Name
          type: string
        type:
          enum:
            - file
            - folder
          title: Type
          type: string
        content:
          default: ''
          title: Content
          type: string
        children:
          default: []
          items:
            $ref: '#/components/schemas/ModelTreeNode'
          title: Children
          type: array
      required:
        - name
        - type
      title: ModelTreeNode
      type: object
  securitySchemes:
    GlobalAuth:
      type: http
      scheme: bearer

````